Mercurial > hg-stable
changeset 46922:17368844f786
split: add test demonstrating issue with empty splits adjusting phases
Differential Revision: https://phab.mercurial-scm.org/D10387
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Mon, 12 Apr 2021 17:51:56 -0700 |
parents | 8f7b1bf3c540 |
children | 8ee1ac083ee7 |
files | tests/test-split.t |
diffstat | 1 files changed, 114 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-split.t Wed Apr 14 16:09:12 2021 +0200 +++ b/tests/test-split.t Mon Apr 12 17:51:56 2021 -0700 @@ -1046,3 +1046,117 @@ [ ui.warning|rollback completed] [ ui.error|abort: empty commit message] [10] + +Test that creating an empty split or "no-op" +(identical to original) commit doesn't cause chaos +-------------------------------------------------- + + $ hg init $TESTTMP/noop + $ cd $TESTTMP/noop + $ echo r0 > r0 + $ hg ci -qAm r0 + $ hg phase -p + $ echo foo > foo + $ hg ci -qAm foo + $ hg log -G -T'{phase} {rev}:{node|short} {desc}' + @ draft 1:ae694b2901bb foo + | + o public 0:222799e2f90b r0 + +FIXME: This should not show "So far it has been split into" + $ printf 'd\na\n' | HGEDITOR=cat hg split || true + diff --git a/foo b/foo + new file mode 100644 + examine changes to 'foo'? + (enter ? for help) [Ynesfdaq?] d + + no changes to record + diff --git a/foo b/foo + new file mode 100644 + examine changes to 'foo'? + (enter ? for help) [Ynesfdaq?] a + + HG: Splitting ae694b2901bb. So far it has been split into: + HG: - 0:222799e2f90b "r0" + HG: Write commit message for the next split changeset. + foo + + + HG: Enter commit message. Lines beginning with 'HG:' are removed. + HG: Leave message empty to abort commit. + HG: -- + HG: user: test + HG: branch 'default' + HG: added foo + warning: commit already existed in the repository! + saved backup bundle to $TESTTMP/noop/.hg/strip-backup/ae694b2901bb-28e0b457-split.hg (obsstore-off !) + transaction abort! (obsstore-on !) + rollback completed (obsstore-on !) + abort: changeset ae694b2901bb cannot obsolete itself (obsstore-on !) +FIXME: this should not have stripped the commit we just no-op split +(obsstore-off only), or made r0 draft. + $ hg log -G -T'{phase} {rev}:{node|short} {desc}' + warning: ignoring unknown working parent ae694b2901bb! (obsstore-off !) + @ draft 1:ae694b2901bb foo (obsstore-on !) + | (obsstore-on !) + o public 0:222799e2f90b r0 (obsstore-on !) + o draft 0:222799e2f90b r0 (obsstore-off !) + + +Now try the same thing but modifying the message so we don't trigger the +identical changeset failures + + $ hg init $TESTTMP/noop2 + $ cd $TESTTMP/noop2 + $ echo r0 > r0 + $ hg ci -qAm r0 + $ hg phase -p + $ echo foo > foo + $ hg ci -qAm foo + $ hg log -G -T'{phase} {rev}:{node|short} {desc}' + @ draft 1:ae694b2901bb foo + | + o public 0:222799e2f90b r0 + + $ cat > $TESTTMP/messages <<EOF + > message1 + > EOF +FIXME: This should not show "So far it has been split into" + $ printf 'd\na\n' | HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py" hg split + diff --git a/foo b/foo + new file mode 100644 + examine changes to 'foo'? + (enter ? for help) [Ynesfdaq?] d + + no changes to record + diff --git a/foo b/foo + new file mode 100644 + examine changes to 'foo'? + (enter ? for help) [Ynesfdaq?] a + + EDITOR: HG: Splitting ae694b2901bb. So far it has been split into: + EDITOR: HG: - 0:222799e2f90b "r0" + EDITOR: HG: Write commit message for the next split changeset. + EDITOR: foo + EDITOR: + EDITOR: + EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. + EDITOR: HG: Leave message empty to abort commit. + EDITOR: HG: -- + EDITOR: HG: user: test + EDITOR: HG: branch 'default' + EDITOR: HG: added foo + created new head + saved backup bundle to $TESTTMP/noop2/.hg/strip-backup/ae694b2901bb-28e0b457-split.hg (obsstore-off !) +FIXME: this should not have made r0 draft + $ hg log -G -T'{phase} {rev}:{node|short} {desc}' + @ draft 1:de675559d3f9 message1 (obsstore-off !) + @ draft 2:de675559d3f9 message1 (obsstore-on !) + | + o draft 0:222799e2f90b r0 + +#if obsstore-on +FIXME: this should not have marked 222799e (r0) as a precursor of anything. + $ hg debugobsolete + ae694b2901bb8b0f8c4b5e075ddec0d63468d57a 222799e2f90be09ccbe49f519c4615d8375a9242 de675559d3f93ffc822c6eb7490e5c73033f17c7 0 * (glob) +#endif