Patchwork [stable] graft: refuse to commit an interrupted graft (issue3667)

login
register
mail settings
Submitter Simon King
Date May 30, 2013, 9:47 p.m.
Message ID <e078ea9b4ce40ee9a85c.1369950458@brian.lan>
Download mbox | patch
Permalink /patch/1673/
State Accepted
Commit e078ea9b4ce40ee9a85c6b9d5db55afc11519bd0
Headers show

Comments

Simon King - May 30, 2013, 9:47 p.m.
# HG changeset patch
# User Simon King <simon@simonking.org.uk>
# Date 1369949530 -3600
# Branch stable
# Node ID e078ea9b4ce40ee9a85c6b9d5db55afc11519bd0
# Parent  39ea540dc1543b5ed31251ef9f394c7902c65f19
graft: refuse to commit an interrupted graft (issue3667)
Matt Mackall - June 1, 2013, 9:39 p.m.
On Thu, 2013-05-30 at 22:47 +0100, Simon King wrote:
> # HG changeset patch
> # User Simon King <simon@simonking.org.uk>
> # Date 1369949530 -3600
> # Branch stable
> # Node ID e078ea9b4ce40ee9a85c6b9d5db55afc11519bd0
> # Parent  39ea540dc1543b5ed31251ef9f394c7902c65f19
> graft: refuse to commit an interrupted graft (issue3667)

Queued for stable, thanks.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1315,6 +1315,10 @@  def commit(ui, repo, *pats, **opts):
         # Let --subrepos on the command line override config setting.
         ui.setconfig('ui', 'commitsubrepos', True)
 
+    if repo.vfs.exists('graftstate'):
+        raise util.Abort(_('cannot commit an interrupted graft operation'),
+                         hint=_('use "hg graft -c" to continue graft'))
+
     extra = {}
     if opts.get('close_branch'):
         extra['close'] = 1
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -174,6 +174,13 @@  Graft out of order, skipping a merge and
   (use hg resolve and hg graft --continue)
   [255]
 
+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)
+  [255]
+
 Continue without resolve should fail:
 
   $ hg graft -c