The following script leads to a broken dirstate in case the commit message for hg ci --amend is empty. $ hg init test $ cd test $ echo a > a $ hg add a $ hg commit -m'a' $ echo b > b $ hg add b $ hg commit -m'b' $ echo bb > b $ hg commit --amend // REMOVE COMMIT MESSAGE transaction abort! rollback completed abort: empty commit message $ hg st warning: ignoring unknown working parent bf09913437fb!
Can't reproduce here.
Can't reproduce either.
Simpler repro: hg init bug3670 cd bug3670 echo a>a hg ci -Ama # this sets up the bug for triggering echo a>>a # delete the commit message below hg ci --amend
it's caused by the temporary commit in cmdutil.amend() opts['message'] = 'temporary amend commit for %s' % old node = commit(ui, repo, commitfunc, pats, opts) this creates a new commit and sets the repo parents. as the transaction is aborted it's not reset properly.
(In reply to comment #3) Still can't get this reproduce: $ ./run-tests.py -l test-3670.t --- /home/idan/dev/hg/tests/test-3670.t +++ /home/idan/dev/hg/tests/test-3670.t.err @@ -6,4 +6,11 @@ $ echo a>>a $ hg ci --amend + saved backup bundle to $TESTTMP/bug3670/.hg/strip-backup/cb9a9f314b8b-amend-backup.hg $ hg log + changeset: 0:bbb36c6acd42 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + ERROR: /home/idan/dev/hg/tests/test-3670.t output changed ! Failed test-3670.t: output changed # Ran 1 tests, 0 skipped, 1 failed. Even if I force it to raise the 'empty commit message' it cleans up fine.
Ok, repros for me by setting editor to false hg init a cd a echo a > a hg ci -qAm0 echo a >> a HGEDITOR=false hg ci --amend hg id --- transaction abort! rollback completed abort: edit failed: hgeditor exited with status 1 warning: ignoring unknown working parent 16f411eed2f6! 000000000000+
Using Matt's script to bisect: The first bad revision is: changeset: 17473:9732473aa24b user: Pierre-Yves David <pierre-yves.david@logilab.fr> date: Sat Aug 25 16:20:41 2012 +0200 summary: amend: use an explicit commit message for temporary amending commit
*** Bug 3725 has been marked as a duplicate of this bug. ***
After some investigation last week, I suspect transaction abortion to not restore journal file. leading the properly backuped dirstate file to be out of sync with the rollbacked repo.
Fixed by http://selenic.com/repo/hg/rev/153659e86a5f Pierre-Yves David <pierre-yves.david@ens-lyon.org> amend: invalidate dirstate in case of failure (issue3670) The temporary commit created by amend update the dirstate. If the final commit fails, we need to invalidate the change made to the dirstate, otherwise the release of the wlock will write the dirstate created after the rollbacked temporary commit. This dirstate writing logic should probably be handled in the same object than the transaction one. However such change are too big for stable. (please test the fix)