[PATCH] amend: drop copy source to files added in amended commit (issue3410)
Idan Kamara
idankk86 at gmail.com
Mon Apr 30 12:44:41 CDT 2012
# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1335807871 -10800
# Branch stable
# Node ID a026e1d1b0e763417fec8a68c9b2755f826b634f
# Parent be786c5ac0a852cab965d9e541611f882bdb0bb8
amend: drop copy source to files added in amended commit (issue3410)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1299,6 +1299,11 @@
# Fix up dirstate for copies and renames
duplicatecopies(repo, None, base.node())
+ # Drop copy source to files added in amended commit
+ for dst, src in repo.dirstate.copies().items():
+ if src not in base:
+ repo.dirstate.copy(None, dst)
+
# First, do a regular commit to record all changes in the working
# directory (if there are any)
node = commit(ui, repo, commitfunc, pats, opts)
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -287,6 +287,17 @@
A f
d
+Move added file (issue3410):
+
+ $ echo g >> g
+ $ hg ci -Am g
+ adding g
+ $ hg mv g h
+ $ hg ci --amend
+ saved backup bundle to $TESTTMP/.hg/strip-backup/8af5b24a1125-amend-backup.hg
+ $ hg st --rev '.^' --copies h
+ A h
+
Can't rollback an amend:
$ hg rollback
More information about the Mercurial-devel
mailing list