tests: add more tests related to stabilization of orphaned merge commit
authorPulkit Goyal <7895pulkit@gmail.com>
Tue, 13 Mar 2018 19:06:14 +0530
changeset 3530 3f056d3a1f70
parent 3529 d90e0faaec80
child 3535 ffc790673892
tests: add more tests related to stabilization of orphaned merge commit This patch more tests related to stabilization of orphaned merge commit. Stabilization of a merge changeset with both the parents is not supported right now and prints a message on how to do that. Maybe we should do that internally as a part of `hg evolve` but I need to think about this.
tests/test-evolve-orphan-merge.t
--- a/tests/test-evolve-orphan-merge.t	Tue Mar 13 18:17:50 2018 +0530
+++ b/tests/test-evolve-orphan-merge.t	Tue Mar 13 19:06:14 2018 +0530
@@ -299,3 +299,123 @@
   |/    () draft
   o  0:8fa14d15e168 added hgignore
       () draft
+
+3) When stabilizing other changesets resulted in orphan merge changeset
+-----------------------------------------------------------------------
+
+  $ hg prune -r d0f84b25d4e3 -r 928097d0b5b5 -r dc1948a6eeab
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory now at 8fa14d15e168
+  3 changesets pruned
+
+  $ for ch in l m; do echo foo > $ch; hg ci -Aqm "added "$ch; done;
+  $ hg up 8fa14d15e168
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ for ch in x y; do echo foo > $ch; hg ci -Aqm "added "$ch; done;
+  $ hg glog
+  @  18:863d11043c67 added y
+  |   () draft
+  o  17:3f2247835c1d added x
+  |   () draft
+  | o  16:e44dc179e7f5 added m
+  | |   () draft
+  | o  15:8634bee7bf1e added l
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg merge
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m "merge commit"
+
+  $ hg up 8634bee7bf1e
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo bar > l
+  $ hg amend
+  2 new orphan changesets
+
+  $ hg glog
+  @  20:fccc9de66799 added l
+  |   () draft
+  | *    19:190763373d8b merge commit
+  | |\    () draft
+  | | o  18:863d11043c67 added y
+  | | |   () draft
+  +---o  17:3f2247835c1d added x
+  | |     () draft
+  | *  16:e44dc179e7f5 added m
+  | |   () draft
+  | x  15:8634bee7bf1e added l
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+  $ hg evolve --all
+  move:[16] added m
+  atop:[20] added l
+  move:[19] merge commit
+  atop:[21] added m
+  working directory is now at a446ad3e6700
+
+  $ hg glog
+  @    22:a446ad3e6700 merge commit
+  |\    () draft
+  | o  21:495d2039f8f1 added m
+  | |   () draft
+  | o  20:fccc9de66799 added l
+  | |   () draft
+  o |  18:863d11043c67 added y
+  | |   () draft
+  o |  17:3f2247835c1d added x
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+4) When both the parents of the merge changeset are obsolete with a succ
+------------------------------------------------------------------------
+
+  $ hg prune -r a446ad3e6700 -r 495d2039f8f1 -r 863d11043c67
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  working directory now at fccc9de66799
+  3 changesets pruned
+
+  $ hg glog
+  @  20:fccc9de66799 added l
+  |   () draft
+  | o  17:3f2247835c1d added x
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m "merged l and x"
+
+  $ hg up fccc9de66799
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo foobar > l
+  $ hg amend
+  1 new orphan changesets
+  $ hg up 3f2247835c1d
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo bar > x
+  $ hg amend
+  $ hg glog
+  @  25:cdf6547da25f added x
+  |   () draft
+  | o  24:3f371171d767 added l
+  |/    () draft
+  | *    23:7b78a9784f3e merged l and x
+  | |\    () draft
+  +---x  20:fccc9de66799 added l
+  | |     () draft
+  | x  17:3f2247835c1d added x
+  |/    () draft
+  o  0:8fa14d15e168 added hgignore
+      () draft
+
+XXX: We should handle this case too
+  $ hg evolve --all
+  warning: no support for evolving merge changesets with two obsolete parents yet
+  (Redo the merge (7b78a9784f3e) and use `hg prune <old> --succ <new>` to obsolete the old one)