# HG changeset patch # User Patrick Mezard # Date 1178489555 -7200 # Node ID 28b7d949ef6a981e5d28aa76372b84acb73e01fb # Parent 1ef4445c6506d8d1f907bba3e48324f39e5c31d1# Parent f700ea2b0689b28d77e71c13042e648373e016c1 Merge with crew-stable. HG: changed hgext/mq.py diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1303,6 +1303,10 @@ class queue: return 0 def series_end(self, all_patches=False): + """If all_patches is False, return the index of the next pushable patch + in the series, or the series length. If all_patches is True, return the + index of the first patch past the last applied one. + """ end = 0 def next(start): if all_patches: @@ -1589,7 +1593,7 @@ def series(ui, repo, **opts): def top(ui, repo, **opts): """print the name of the current patch""" q = repo.mq - t = q.series_end() + t = q.applied and q.series_end(True) or 0 if t: return q.qseries(repo, start=t-1, length=1, status='A', summary=opts.get('summary')) diff --git a/tests/test-mq-guards b/tests/test-mq-guards --- a/tests/test-mq-guards +++ b/tests/test-mq-guards @@ -54,6 +54,8 @@ hg qguard c.patch echo % should skip c.patch hg qpush -a +echo % should display b.patch +hg qtop hg qguard -n c.patch echo % should push c.patch diff --git a/tests/test-mq-guards.out b/tests/test-mq-guards.out --- a/tests/test-mq-guards.out +++ b/tests/test-mq-guards.out @@ -25,6 +25,8 @@ c.patch: -a applying b.patch skipping c.patch - guarded by '-a' Now at: b.patch +% should display b.patch +b.patch % should push c.patch applying c.patch Now at: c.patch