--- a/hgext/mq.py Tue Aug 08 17:11:36 2006 -0700
+++ b/hgext/mq.py Wed Aug 09 09:38:11 2006 -0700
@@ -176,11 +176,11 @@
if exactneg:
return False, exactneg[0]
pos = [g for g in patchguards if g[0] == '+']
- exactpos = [g for g in pos if g[1:] in guards]
+ nonpos = [g for g in pos if g[1:] not in guards]
if pos:
- if exactpos:
- return True, exactpos[0]
- return False, ''
+ if not nonpos:
+ return True, ''
+ return False, nonpos
return True, ''
def explain_pushable(self, idx, all_patches=False):
@@ -201,9 +201,9 @@
write(_('allowing %s - guarded by %r\n') %
(self.series[idx], why))
if not pushable:
- if why and why[0] in '-+':
+ if why:
write(_('skipping %s - guarded by %r\n') %
- (self.series[idx], why))
+ (self.series[idx], ' '.join(why)))
else:
write(_('skipping %s - no matching guards\n') %
self.series[idx])
@@ -1740,7 +1740,8 @@
this sets "stable" guard. mq will skip foo.patch (because it has
nagative match) but push bar.patch (because it has posative
- match).
+ match). patch is pushed only if all posative guards match and no
+ nagative guards match.
with no arguments, default is to print current active guards.
with arguments, set active guards as given.
@@ -1760,9 +1761,8 @@
if not args:
ui.status(_('guards deactivated\n'))
if q.series:
- pushable = [p for p in q.unapplied(repo) if q.pushable(p[0])[0]]
ui.status(_('%d of %d unapplied patches active\n') %
- (len(pushable), len(q.series)))
+ (len(q.unapplied(repo)), len(q.series)))
elif opts['series']:
guards = {}
noguards = 0
--- a/tests/test-mq-guards Tue Aug 08 17:11:36 2006 -0700
+++ b/tests/test-mq-guards Wed Aug 09 09:38:11 2006 -0700
@@ -59,4 +59,26 @@
hg qpop -a
hg qselect -n
+echo % should push all
hg qpush -a
+
+hg qpop -a
+hg qguard a.patch +1 +2
+hg qselect 1
+echo % should push b.patch
+hg qpush
+hg qpop -a
+
+hg qselect 2
+hg qpush
+hg qpop -a
+
+hg qselect 1 2
+echo % should push a.patch
+hg qpush
+hg qpop -a
+
+hg qguard a.patch +1 +2 -3
+hg qselect 1 2 3
+echo % should push b.patch
+hg qpush
--- a/tests/test-mq-guards.out Tue Aug 08 17:11:36 2006 -0700
+++ b/tests/test-mq-guards.out Wed Aug 09 09:38:11 2006 -0700
@@ -21,7 +21,7 @@
c.patch: -a
% should skip c.patch
applying b.patch
-skipping c.patch - guarded by '-a'
+skipping c.patch - guarded by '- a'
Now at: b.patch
% should push c.patch
applying c.patch
@@ -29,6 +29,26 @@
Patch queue now empty
guards deactivated
2 of 3 unapplied patches active
+% should push all
applying b.patch
applying c.patch
Now at: c.patch
+Patch queue now empty
+2 of 3 unapplied patches active
+% should push b.patch
+applying b.patch
+Now at: b.patch
+Patch queue now empty
+2 of 3 unapplied patches active
+applying b.patch
+Now at: b.patch
+Patch queue now empty
+3 of 3 unapplied patches active
+% should push a.patch
+applying a.patch
+Now at: a.patch
+Patch queue now empty
+2 of 3 unapplied patches active
+% should push b.patch
+applying b.patch
+Now at: b.patch