diff --git a/hgext/mq.py b/hgext/mq.py index f98abe3146b24a1e50e1c554850fbe5a8994d4fc_aGdleHQvbXEucHk=..fd0f0b0d316d2268c26ea4e7cfa6439bcb3366aa_aGdleHQvbXEucHk= 100644 --- a/hgext/mq.py +++ b/hgext/mq.py @@ -2969,5 +2969,6 @@ q = repo.mq guards = q.active() + pushable = lambda i: q.pushable(q.applied[i].name)[0] if args or opts.get('none'): old_unapplied = q.unapplied(repo) @@ -2972,10 +2973,9 @@ if args or opts.get('none'): old_unapplied = q.unapplied(repo) - old_guarded = [i for i in xrange(len(q.applied)) if - not q.pushable(i)[0]] + old_guarded = [i for i in xrange(len(q.applied)) if not pushable(i)] q.setactive(args) q.savedirty() if not args: ui.status(_('guards deactivated\n')) if not opts.get('pop') and not opts.get('reapply'): unapplied = q.unapplied(repo) @@ -2976,11 +2976,10 @@ q.setactive(args) q.savedirty() if not args: ui.status(_('guards deactivated\n')) if not opts.get('pop') and not opts.get('reapply'): unapplied = q.unapplied(repo) - guarded = [i for i in xrange(len(q.applied)) - if not q.pushable(i)[0]] + guarded = [i for i in xrange(len(q.applied)) if not pushable(i)] if len(unapplied) != len(old_unapplied): ui.status(_('number of unguarded, unapplied patches has ' 'changed from %d to %d\n') % diff --git a/tests/test-mq-guards.t b/tests/test-mq-guards.t index f98abe3146b24a1e50e1c554850fbe5a8994d4fc_dGVzdHMvdGVzdC1tcS1ndWFyZHMudA==..fd0f0b0d316d2268c26ea4e7cfa6439bcb3366aa_dGVzdHMvdGVzdC1tcS1ndWFyZHMudA== 100644 --- a/tests/test-mq-guards.t +++ b/tests/test-mq-guards.t @@ -388,7 +388,6 @@ 3 G d.patch $ hg qselect 2 number of unguarded, unapplied patches has changed from 0 to 1 - number of guarded, applied patches has changed from 1 to 0 $ qappunappv % hg qapplied new.patch @@ -507,3 +506,31 @@ 0 G new.patch 1 A c.patch 2 A d.patch + +test that qselect shows "number of guarded, applied patches" correctly + + $ hg qimport -q -e b.patch + adding b.patch to series file + $ hg qguard -- b.patch -not-b + $ hg qpop -a -q + patch queue now empty + $ hg qunapplied -v + 0 G new.patch + 1 U c.patch + 2 U d.patch + 3 U b.patch + $ hg qselect not-new not-c + number of unguarded, unapplied patches has changed from 3 to 2 + $ hg qpush -q -a + patch d.patch is empty + now at: b.patch + + $ hg qapplied -v + 0 G new.patch + 1 G c.patch + 2 A d.patch + 3 A b.patch + $ hg qselect --none + guards deactivated + $ hg qselect not-new not-c not-d + number of guarded, applied patches has changed from 0 to 1 diff --git a/tests/test-mq-qpush-fail.t b/tests/test-mq-qpush-fail.t index f98abe3146b24a1e50e1c554850fbe5a8994d4fc_dGVzdHMvdGVzdC1tcS1xcHVzaC1mYWlsLnQ=..fd0f0b0d316d2268c26ea4e7cfa6439bcb3366aa_dGVzdHMvdGVzdC1tcS1xcHVzaC1mYWlsLnQ= 100644 --- a/tests/test-mq-qpush-fail.t +++ b/tests/test-mq-qpush-fail.t @@ -131,4 +131,9 @@ now at: c now try it when a is unguarded, and we're at the top of the queue + + $ hg qapplied -v + 0 G a + 1 A b + 2 A c $ hg qsel block @@ -134,5 +139,4 @@ $ hg qsel block - number of guarded, applied patches has changed from 1 to 0 $ hg qpush b abort: cannot push to a previous patch: b [255]