[PATCH 2 of 2] mq: qtop was broken when holes appear within the patch sequence

Patrick Mézard pmezard at gmail.com
Sun May 6 17:24:35 UTC 2007


Brendan Cully a écrit :
> On Thursday, 12 April 2007 at 22:48, Patrick Mezard wrote:
>> # HG changeset patch
>> # User Patrick Mezard <pmezard at gmail.com>
>> # Date 1176410532 -7200
>> # Node ID b785bf3b04d661f0ce5c67890cb870c46f673e08
>> # Parent  a6ecb9d1ae8d0e697c9171706ccb004dc1027b61
>> mq: qtop was broken when holes appear within the patch sequence.
>>
>> diff -r a6ecb9d1ae8d -r b785bf3b04d6 hgext/mq.py
>> --- a/hgext/mq.py	Thu Apr 12 22:41:50 2007 +0200
>> +++ b/hgext/mq.py	Thu Apr 12 22:42:12 2007 +0200
>> @@ -1588,7 +1588,9 @@ def top(ui, repo, **opts):
>>      q = repo.mq
>>      t = len(q.applied)
>>      if t:
>> -        return q.qseries(repo, start=t-1, length=1, status='A',
>> +        applied = dict.fromkeys([p.name for p in q.applied])
>> +        topmost = [i for i,p in enumerate(q.series) if p in applied][-1]
>> +        return q.qseries(repo, start=topmost, length=1, status='A',
>>                           summary=opts.get('summary'))
>>      else:
>>          ui.write("No patches applied\n")
> 
> I've applied the attached (simpler) patch instead.

It still breaks when the series ends with guarded patches. A test case 
and fix are attached. What happens is q.series_end() returns the end of 
the full series because there are no more pushable patches, then 
q.qseries() start iterating on the last guarded patch and ignores it.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test-qtop.diff
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20070506/732fbd46/attachment.diff>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix-qtop.diff
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20070506/732fbd46/attachment-0001.diff>


More information about the Mercurial-devel mailing list