[PATCH 3 of 4] mq: introduce qgoto --check
Patrick Mezard
patrick at mezard.eu
Fri May 11 18:12:42 CDT 2012
# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1336774770 -7200
# Node ID f4da2aeb000408aa54f59829acb092ec85914475
# Parent 82b2d5bb906d9d2a72e0648830e30a39c90f046e
mq: introduce qgoto --check
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2525,7 +2525,8 @@
wlock.release()
@command("qgoto",
- [('f', 'force', None, _('overwrite any local changes')),
+ [('c', 'check', None, _('tolerate non-conflicting local changes')),
+ ('f', 'force', None, _('overwrite any local changes')),
('', 'no-backup', None, _('do not save backup copies of files'))],
_('hg qgoto [OPTION]... PATCH'))
def goto(ui, repo, patch, **opts):
@@ -2535,10 +2536,13 @@
q = repo.mq
patch = q.lookup(patch)
nobackup = opts.get('no_backup')
+ check = opts.get('check')
if q.isapplied(patch):
- ret = q.pop(repo, patch, force=opts.get('force'), nobackup=nobackup)
+ ret = q.pop(repo, patch, force=opts.get('force'), nobackup=nobackup,
+ check=check)
else:
- ret = q.push(repo, patch, force=opts.get('force'), nobackup=nobackup)
+ ret = q.push(repo, patch, force=opts.get('force'), nobackup=nobackup,
+ check=check)
q.savedirty()
return ret
diff --git a/tests/test-mq-qpush-fail.t b/tests/test-mq-qpush-fail.t
--- a/tests/test-mq-qpush-fail.t
+++ b/tests/test-mq-qpush-fail.t
@@ -368,3 +368,22 @@
$ cat b
b
b
+
+test qgoto --check
+
+ $ hg revert -aq b
+ $ rm e
+ $ hg qgoto --check --force p3
+ abort: cannot use both --force and --check
+ [255]
+ $ echo a >> a
+ $ hg qgoto --check p3
+ applying p3
+ now at: p3
+ $ hg st a
+ M a
+ $ hg qgoto --check p2
+ popping p3
+ now at: p2
+ $ hg st a
+ M a
More information about the Mercurial-devel
mailing list