Mercurial > hg
changeset 2850:851b07ec450c
mq: apply patch is any posative guard matches
this is like guards command from quilt package.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Thu, 10 Aug 2006 17:18:55 -0700 |
parents | 3b21013e7680 |
children | 82f50658c72b |
files | hgext/mq.py tests/test-mq-guards tests/test-mq-guards.out |
diffstat | 3 files changed, 54 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Thu Aug 10 17:02:11 2006 -0700 +++ b/hgext/mq.py Thu Aug 10 17:18:55 2006 -0700 @@ -176,11 +176,11 @@ if exactneg: return False, exactneg[0] pos = [g for g in patchguards if g[0] == '+'] - nonpos = [g for g in pos if g[1:] not in guards] + exactpos = [g for g in pos if g[1:] in guards] if pos: - if not nonpos: - return True, '' - return False, nonpos + if exactpos: + return True, exactpos[0] + return False, pos return True, '' def explain_pushable(self, idx, all_patches=False): @@ -1742,7 +1742,7 @@ this sets "stable" guard. mq will skip foo.patch (because it has nagative match) but push bar.patch (because it has posative - match). patch is pushed only if all posative guards match and no + match). patch is pushed if any posative guards match and no nagative guards match. with no arguments, default is to print current active guards.
--- a/tests/test-mq-guards Thu Aug 10 17:02:11 2006 -0700 +++ b/tests/test-mq-guards Thu Aug 10 17:18:55 2006 -0700 @@ -63,25 +63,39 @@ hg qpush -a hg qpop -a -hg qguard a.patch +1 +2 +hg qguard a.patch +1 +hg qguard b.patch +2 hg qselect 1 +echo % should push a.patch, not b.patch +hg qpush +hg qpush +hg qpop -a + +hg qselect 2 echo % should push b.patch hg qpush hg qpop -a -hg qselect 2 +hg qselect 1 2 +echo % should push a.patch, b.patch 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 % list patches and guards +hg qguard -l +echo % list series +hg qseries -v +echo % list guards +hg qselect echo % should push b.patch hg qpush hg qpush -a hg qselect -n --reapply +echo % guards in series file: +1 +2 -3 +hg qselect -s +echo % should show c.patch +hg qapplied
--- a/tests/test-mq-guards.out Thu Aug 10 17:02:11 2006 -0700 +++ b/tests/test-mq-guards.out Thu Aug 10 17:18:55 2006 -0700 @@ -34,19 +34,37 @@ applying c.patch Now at: c.patch Patch queue now empty +number of unguarded, unapplied patches has changed from 1 to 2 +% should push a.patch, not b.patch +applying a.patch +Now at: a.patch +applying c.patch +Now at: c.patch +Patch queue now empty % should push b.patch applying b.patch Now at: b.patch Patch queue now empty +number of unguarded, unapplied patches has changed from 2 to 3 +% should push a.patch, b.patch +applying a.patch +Now at: a.patch applying b.patch Now at: b.patch Patch queue now empty -number of unguarded, unapplied patches has changed from 2 to 3 -% should push a.patch -applying a.patch -Now at: a.patch -Patch queue now empty number of unguarded, unapplied patches has changed from 3 to 2 +% list patches and guards +a.patch: +1 +2 -3 +b.patch: +2 +c.patch: unguarded +% list series +0 G a.patch +1 U b.patch +2 U c.patch +% list guards +1 +2 +3 % should push b.patch applying b.patch Now at: b.patch @@ -56,6 +74,11 @@ popping guarded patches Patch queue now empty reapplying unguarded patches -applying b.patch applying c.patch Now at: c.patch +% guards in series file: +1 +2 -3 ++1 ++2 +-3 +% should show c.patch +c.patch