diff hgext/mq.py @ 22453:fd0f0b0d316d stable

mq: report correct numbers for changing "number of guarded, applied patches" Before this patch, "hg qselect" may report incorrect numbers for "number of guarded, applied patches has changed", because it examines "pushable" of patches by the index not in "the series" but in "applied patches", even though "mq.pushable()" expects the former. To report correct numbers for changing "number of guarded, applied patches", this patch uses the name of applied patch to examine pushable-ness of it. This patch also changes the result of existing "hg qselect" tests, because they doesn't change pushable-ness of already applied patches. This patch assumes that "hg qselect" focuses on changing pushable-ness only of already applied patches, because: - the report message uses not "previous" (in the series) but "applied" - the logic to pop patches for --pop/--reapply examines pushable-ness only of already applied ones (in fact, there are some incorrect code paths)
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 12 Sep 2014 02:29:19 +0900
parents fd7839d1107d
children ac31d87608d6
line wrap: on
line diff
--- a/hgext/mq.py	Wed Sep 10 00:41:44 2014 +0900
+++ b/hgext/mq.py	Fri Sep 12 02:29:19 2014 +0900
@@ -2969,18 +2969,17 @@
 
     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)
-        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)
-            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') %