https://bz.mercurial-scm.org/show_bug.cgi?id=6233
Bug ID: 6233 Summary: `hg commit --amend` can corrupt dirstate if files are modified while editor is open Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: h...@pewpew.net CC: mercurial-devel@mercurial-scm.org Python Version: 2.7 Basically: run `hg commit --amend`, and while the editor is open, modify one of the files again. Save and quit the editor. There is a high likelihood (if the file isn't new, I've reproduced this 100% of the time) that the modifications made coincident with the editor invocation are NOT picked up, but that the dirstate IS updated to say that they have been. Example .t test, at 5.1.2+537-6a350194de7f, this produces: - OK. + Bug detected. 'delta' is not part of the commit OR the wdir + Diff and status before rebuild: + Diff and status after rebuild: + diff --git a/foo b/foo + --- a/foo + +++ b/foo + @@ -1,2 +1,3 @@ + alpha + beta + +delta + M foo Modifying a file while the editor is open can cause dirstate corruption $ hg init modify-during-amend; cd modify-during-amend $ echo r0 > foo; hg commit -qAm "r0" $ echo alpha > foo; hg commit -qm "alpha" $ echo beta >> foo $ cat > $TESTTMP/sleepy_editor <<EOF > sleep 3 > EOF $ chmod +x $TESTTMP/sleepy_editor $ HGEDITOR=$TESTTMP/sleepy_editor hg commit --amend & $ sleep 1 $ echo delta >> foo $ sleep 3 $ if (hg diff -c . | grep -q 'delta') || [[ -n "$(hg status)" ]]; then > echo "OK." > else > echo "Bug detected. 'delta' is not part of the commit OR the wdir" > echo "Diff and status before rebuild:" > hg diff > hg status > hg debugrebuilddirstate > echo "Diff and status after rebuild:" > hg diff > hg status > fi OK. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel