update: remove .hg/graftstate on clean (issue3970) stable
authorSiddharth Agarwal <sid0@fb.com>
Fri, 28 Jun 2013 16:58:31 -0700
branchstable
changeset 19332 0af993732f66
parent 19319 ec17ddecdf64
child 19370 f84aa729057f
update: remove .hg/graftstate on clean (issue3970) e078ea9b4ce4 introduced a check for interrupted grafts while committing. This exposed a bug where hg update --clean didn't remove that file.
mercurial/hg.py
tests/test-graft.t
--- a/mercurial/hg.py	Wed Jun 19 23:05:40 2013 -0700
+++ b/mercurial/hg.py	Fri Jun 28 16:58:31 2013 -0700
@@ -472,6 +472,7 @@
 def clean(repo, node, show_stats=True):
     """forcibly switch the working directory to node, clobbering changes"""
     stats = updaterepo(repo, node, True)
+    util.unlinkpath(repo.join('graftstate'), ignoremissing=True)
     if show_stats:
         _showstats(repo, stats)
     return stats[3] > 0
--- a/tests/test-graft.t	Wed Jun 19 23:05:40 2013 -0700
+++ b/tests/test-graft.t	Fri Jun 28 16:58:31 2013 -0700
@@ -181,6 +181,32 @@
   (use "hg graft -c" to continue graft)
   [255]
 
+Abort the graft and try committing:
+
+  $ hg up -C .
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo c >> e
+  $ hg ci -mtest
+
+  $ hg strip . --config extensions.mq=
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
+
+Graft again:
+
+  $ hg graft 1 5 4 3 'merge()' 2
+  skipping ungraftable merge revision 6
+  skipping already grafted revision 2
+  skipping already grafted revision 1
+  skipping already grafted revision 5
+  grafting revision 4
+  merging e
+  warning: conflicts during merge.
+  merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
+  abort: unresolved conflicts, can't continue
+  (use hg resolve and hg graft --continue)
+  [255]
+
 Continue without resolve should fail:
 
   $ hg graft -c