##// END OF EJS Templates
mq: make guards more strict, add tests
Vadim Gelfer -
r2829:05316bb5 default
parent child Browse files
Show More
@@ -176,11 +176,11 b' class queue:'
176 if exactneg:
176 if exactneg:
177 return False, exactneg[0]
177 return False, exactneg[0]
178 pos = [g for g in patchguards if g[0] == '+']
178 pos = [g for g in patchguards if g[0] == '+']
179 exactpos = [g for g in pos if g[1:] in guards]
179 nonpos = [g for g in pos if g[1:] not in guards]
180 if pos:
180 if pos:
181 if exactpos:
181 if not nonpos:
182 return True, exactpos[0]
182 return True, ''
183 return False, ''
183 return False, nonpos
184 return True, ''
184 return True, ''
185
185
186 def explain_pushable(self, idx, all_patches=False):
186 def explain_pushable(self, idx, all_patches=False):
@@ -201,9 +201,9 b' class queue:'
201 write(_('allowing %s - guarded by %r\n') %
201 write(_('allowing %s - guarded by %r\n') %
202 (self.series[idx], why))
202 (self.series[idx], why))
203 if not pushable:
203 if not pushable:
204 if why and why[0] in '-+':
204 if why:
205 write(_('skipping %s - guarded by %r\n') %
205 write(_('skipping %s - guarded by %r\n') %
206 (self.series[idx], why))
206 (self.series[idx], ' '.join(why)))
207 else:
207 else:
208 write(_('skipping %s - no matching guards\n') %
208 write(_('skipping %s - no matching guards\n') %
209 self.series[idx])
209 self.series[idx])
@@ -1740,7 +1740,8 b' def select(ui, repo, *args, **opts):'
1740
1740
1741 this sets "stable" guard. mq will skip foo.patch (because it has
1741 this sets "stable" guard. mq will skip foo.patch (because it has
1742 nagative match) but push bar.patch (because it has posative
1742 nagative match) but push bar.patch (because it has posative
1743 match).
1743 match). patch is pushed only if all posative guards match and no
1744 nagative guards match.
1744
1745
1745 with no arguments, default is to print current active guards.
1746 with no arguments, default is to print current active guards.
1746 with arguments, set active guards as given.
1747 with arguments, set active guards as given.
@@ -1760,9 +1761,8 b' def select(ui, repo, *args, **opts):'
1760 if not args:
1761 if not args:
1761 ui.status(_('guards deactivated\n'))
1762 ui.status(_('guards deactivated\n'))
1762 if q.series:
1763 if q.series:
1763 pushable = [p for p in q.unapplied(repo) if q.pushable(p[0])[0]]
1764 ui.status(_('%d of %d unapplied patches active\n') %
1764 ui.status(_('%d of %d unapplied patches active\n') %
1765 (len(pushable), len(q.series)))
1765 (len(q.unapplied(repo)), len(q.series)))
1766 elif opts['series']:
1766 elif opts['series']:
1767 guards = {}
1767 guards = {}
1768 noguards = 0
1768 noguards = 0
@@ -59,4 +59,26 b' hg qpush -a'
59
59
60 hg qpop -a
60 hg qpop -a
61 hg qselect -n
61 hg qselect -n
62 echo % should push all
62 hg qpush -a
63 hg qpush -a
64
65 hg qpop -a
66 hg qguard a.patch +1 +2
67 hg qselect 1
68 echo % should push b.patch
69 hg qpush
70 hg qpop -a
71
72 hg qselect 2
73 hg qpush
74 hg qpop -a
75
76 hg qselect 1 2
77 echo % should push a.patch
78 hg qpush
79 hg qpop -a
80
81 hg qguard a.patch +1 +2 -3
82 hg qselect 1 2 3
83 echo % should push b.patch
84 hg qpush
@@ -21,7 +21,7 b' Now at: a.patch'
21 c.patch: -a
21 c.patch: -a
22 % should skip c.patch
22 % should skip c.patch
23 applying b.patch
23 applying b.patch
24 skipping c.patch - guarded by '-a'
24 skipping c.patch - guarded by '- a'
25 Now at: b.patch
25 Now at: b.patch
26 % should push c.patch
26 % should push c.patch
27 applying c.patch
27 applying c.patch
@@ -29,6 +29,26 b' Now at: c.patch'
29 Patch queue now empty
29 Patch queue now empty
30 guards deactivated
30 guards deactivated
31 2 of 3 unapplied patches active
31 2 of 3 unapplied patches active
32 % should push all
32 applying b.patch
33 applying b.patch
33 applying c.patch
34 applying c.patch
34 Now at: c.patch
35 Now at: c.patch
36 Patch queue now empty
37 2 of 3 unapplied patches active
38 % should push b.patch
39 applying b.patch
40 Now at: b.patch
41 Patch queue now empty
42 2 of 3 unapplied patches active
43 applying b.patch
44 Now at: b.patch
45 Patch queue now empty
46 3 of 3 unapplied patches active
47 % should push a.patch
48 applying a.patch
49 Now at: a.patch
50 Patch queue now empty
51 2 of 3 unapplied patches active
52 % should push b.patch
53 applying b.patch
54 Now at: b.patch
General Comments 0
You need to be logged in to leave comments. Login now