changeset 41363:c7d425f7f5c9

tests: add more tests of uncommit/unamend with copies The unamend tests show suboptimal behavior. Differential Revision: https://phab.mercurial-scm.org/D5658
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 18 Jan 2019 17:08:02 -0800
parents 713fbf057c7d
children 7be231f5a4ad
files tests/test-unamend.t tests/test-uncommit.t
diffstat 2 files changed, 77 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-unamend.t	Fri Jan 18 16:49:18 2019 -0800
+++ b/tests/test-unamend.t	Fri Jan 18 17:08:02 2019 -0800
@@ -372,3 +372,40 @@
   rename to wat
   $ hg revert -qa
   $ rm foobar wat
+
+Rename a->b, then amend b->c. After unamend, should look like b->c.
+
+  $ hg co -q 0
+  $ hg mv a b
+  $ hg ci -qm 'move to a b'
+  $ hg mv b c
+  $ hg amend
+  $ hg unamend
+  $ hg st --copies --change .
+  A b
+    a
+  R a
+BROKEN: should indicate that b was renamed to c
+  $ hg st --copies
+  A c
+  R b
+  $ hg revert -qa
+  $ rm c
+
+Rename a->b, then amend b->c, and working copy change c->d. After unamend, should look like b->d
+
+  $ hg co -q 0
+  $ hg mv a b
+  $ hg ci -qm 'move to a b'
+  $ hg mv b c
+  $ hg amend
+  $ hg mv c d
+  $ hg unamend
+  $ hg st --copies --change .
+  A b
+    a
+  R a
+BROKEN: should indicate that b was renamed to d
+  $ hg st --copies
+  A d
+  R b
--- a/tests/test-uncommit.t	Fri Jan 18 16:49:18 2019 -0800
+++ b/tests/test-uncommit.t	Fri Jan 18 17:08:02 2019 -0800
@@ -398,3 +398,43 @@
   |/
   o  0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
   
+
+Rename a->b, then remove b in working copy. Result should remove a.
+
+  $ hg co -q 0
+  $ hg mv a b
+  $ hg ci -qm 'move a to b'
+  $ hg rm b
+  $ hg uncommit --config experimental.uncommitondirtywdir=True
+  $ hg st --copies
+  R a
+  $ hg revert a
+
+Rename a->b, then rename b->c in working copy. Result should rename a->c.
+
+  $ hg co -q 0
+  $ hg mv a b
+  $ hg ci -qm 'move a to b'
+  $ hg mv b c
+  $ hg uncommit --config experimental.uncommitondirtywdir=True
+  $ hg st --copies
+  A c
+    a
+  R a
+  $ hg revert a
+  $ hg forget c
+  $ rm c
+
+Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c.
+
+  $ hg co -q 0
+  $ hg cp a b1
+  $ hg cp a b2
+  $ hg ci -qm 'move a to b1 and b2'
+  $ hg mv b1 c
+  $ hg uncommit --config experimental.uncommitondirtywdir=True
+  $ hg st --copies
+  A b2
+    a
+  A c
+    a