changeset 19476:4fed15d4c5aa stable

commands: add checks for unfinished operations (issue3955) commands checked: backout bisect commit graft import
author Matt Mackall <mpm@selenic.com>
date Wed, 24 Jul 2013 23:51:40 -0500
parents e24531a23ae4
children e9351f0d9a2a
files mercurial/commands.py tests/test-graft.t
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Jul 24 23:30:24 2013 -0500
+++ b/mercurial/commands.py	Wed Jul 24 23:51:40 2013 -0500
@@ -428,6 +428,7 @@
     if date:
         opts['date'] = util.parsedate(date)
 
+    cmdutil.checkunfinished(repo)
     cmdutil.bailifchanged(repo)
     node = scmutil.revsingle(repo, rev).node()
 
@@ -651,6 +652,8 @@
     elif extra or good + bad + skip + reset + extend + bool(command) > 1:
         raise util.Abort(_('incompatible arguments'))
 
+    cmdutil.checkunfinished(repo)
+
     if reset:
         p = repo.join("bisect.state")
         if os.path.exists(p):
@@ -1333,9 +1336,7 @@
     # Save this for restoring it later
     oldcommitphase = ui.config('phases', 'new-commit')
 
-    if repo.vfs.exists('graftstate'):
-        raise util.Abort(_('cannot commit an interrupted graft operation'),
-                         hint=_('use "hg graft -c" to continue graft'))
+    cmdutil.checkunfinished(repo)
 
     branch = repo[None].branch()
     bheads = repo.branchheads(branch)
@@ -2977,6 +2978,7 @@
                 raise
             raise util.Abort(_("no graft state found, can't continue"))
     else:
+        cmdutil.checkunfinished(repo)
         cmdutil.bailifchanged(repo)
         if not revs:
             raise util.Abort(_('no revisions specified'))
@@ -3656,6 +3658,8 @@
     if sim and not update:
         raise util.Abort(_('cannot use --similarity with --bypass'))
 
+    if update:
+        cmdutil.checkunfinished(repo)
     if (opts.get('exact') or not opts.get('force')) and update:
         cmdutil.bailifchanged(repo)
 
--- a/tests/test-graft.t	Wed Jul 24 23:30:24 2013 -0500
+++ b/tests/test-graft.t	Wed Jul 24 23:51:40 2013 -0500
@@ -177,8 +177,8 @@
 Commit while interrupted should fail:
 
   $ hg ci -m 'commit interrupted graft'
-  abort: cannot commit an interrupted graft operation
-  (use "hg graft -c" to continue graft)
+  abort: graft in progress
+  (use 'hg graft --continue' or 'hg update' to abort)
   [255]
 
 Abort the graft and try committing: