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

Patrick Mezard pmezard at gmail.com
Thu Apr 12 20:48:50 UTC 2007


# 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")



More information about the Mercurial-devel mailing list