mq: introduce qgoto --check
authorPatrick Mezard <patrick@mezard.eu>
Sat, 12 May 2012 00:19:30 +0200
changeset 16655 6ca125af882f
parent 16654 490ed8972f1b
child 16656 4ae3ba9e4d7a
mq: introduce qgoto --check
hgext/mq.py
tests/test-mq-qpush-fail.t
--- a/hgext/mq.py	Sat May 12 00:19:30 2012 +0200
+++ b/hgext/mq.py	Sat May 12 00:19:30 2012 +0200
@@ -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
 
--- a/tests/test-mq-qpush-fail.t	Sat May 12 00:19:30 2012 +0200
+++ b/tests/test-mq-qpush-fail.t	Sat May 12 00:19:30 2012 +0200
@@ -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