[PATCH 1 of 1 stable] update: remove .hg/graftstate on clean (issue3970)
Siddharth Agarwal
sid0 at fb.com
Fri Jun 28 20:26:50 CDT 2013
# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1372463911 25200
# Fri Jun 28 16:58:31 2013 -0700
# Node ID 9b8c82497c9fd777733ad06d99b2b7743817cac1
# Parent d4f8d94edf49ca1d6ef80ef1fbba056544830946
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.
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -471,6 +471,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
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -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
More information about the Mercurial-devel
mailing list