Initiallyt reported on bitbucket by Gerg Ward Rename + commit works fine, as ever. Amending that commit: no problem. Redo the rename ("oops, I wanted to call that file a2, not a1") and amend: problem. Rename info is lost. Here's a test script: setup test repo $ hg init $ cat >> .hg/hgrc <<EOF > [extensions] > rebase = > evolve = ~/src/hg-evolve/hgext/evolve.py > EOF $ echo a > a $ hg ci -A -m init adding a initial rename $ hg mv a a1 $ hg st -C A a1 a R a $ hg ci -m'rename (v1)' amend the rename (new commit message, no change to filenames or content) $ hg amend -m'rename (v2)' $ hg st -C --ch . A a1 a R a redo the rename: instead of moving into d1, move into d2 $ hg mv a1 a2 $ hg pdiff --git diff --git a/a b/a2 rename from a rename to a2 $ hg amend -m'rename (v3)' $ hg st -C --ch . A a2 a R a This fails as follows: ERROR: /home/greg/src/hg-evolve/tests/test-rename.t output changed --- /home/greg/src/hg-evolve/tests/test-rename.t +++ /home/greg/src/hg-evolve/tests/test-rename.t.err @@ -33,5 +33,4 @@ $ hg amend -m'rename (v3)' $ hg st -C --ch . A a2 - a R a ! Failed test-rename.t: output changed # Ran 1 tests, 0 skipped, 1 failed. Same result with Mercurial 2.9.2 and 3.0-rc; and with tip of stable and default in mutable-history.
Updated repro script for Mercurial core. Enable evolve to see the bug $ cat >> $HGRCPATH <<EOF > [extensions] > rebase = > EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH setup test repo $ hg init $ echo a > a $ hg ci -A -m init adding a initial rename $ hg mv a a1 $ hg st -C A a1 a R a $ hg ci -m'rename (v1)' amend the rename (new commit message, no change to filenames or content) $ hg commit --amend -m'rename (v2)' $ hg st -C --ch . A a1 a R a redo the rename: instead of moving into d1, move into d2 $ hg mv a1 a2 $ hg diff --rev .^ --git diff --git a/a b/a2 rename from a rename to a2 $ hg commit --amend -m'rename (v3)' $ hg st -C --ch . A a2 a R a
The previous copy past has a buggy reference to evolve: lets do it again Enable evolve to see the bug $ cat > obs.py << EOF > import mercurial.obsolete > mercurial.obsolete._enabled = True > EOF $ echo '[extensions]' >> $HGRCPATH $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH setup test repo $ hg init repo $ cd repo $ echo a > a $ hg ci -A -m init adding a initial rename $ hg mv a a1 $ hg st -C A a1 a R a $ hg ci -m'rename (v1)' amend the rename (new commit message, no change to filenames or content) $ hg commit --amend -m'rename (v2)' $ hg st -C --ch . A a1 a R a redo the rename: instead of moving into d1, move into d2 $ hg mv a1 a2 $ hg diff --rev .^ --git diff --git a/a b/a2 rename from a rename to a2 $ hg commit --amend -m'rename (v3)' $ hg st -C --ch . A a2 a R a
Disturbing fact. The diff is correct. But the status is wrong.
Fixed by http://selenic.com/repo/hg/rev/652ab726ba93 Ryan McElroy <rmcelroy@fb.com> amend: fix amending rename commit with diverged topologies (issue4405) This addresses the bug described in issue4405: when obsolescence markers are enabled, amending a commit with a file move can lead to the copy information being lost. However, the bug is more general and can be reproduced without obsmarkers as well, as demonstracted by Pierre-Yves and put into the updated test. Specifically, graph topology divergences between the filelogs and the changelog can cause copy information to be lost during amends. (please test the fix)
Bulk testing -> fixed