changeset 5776:453ba695c3d4

tests: add test for in-memory evolve, not actually in-memory yet The next patch will make `hg evolve` use in-memory merge. This patch adds a test case for that. I'm adding it before the implementation so it's easy to see what the behavior change is.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 01 Oct 2020 12:34:36 -0700
parents 4a38b12141b5
children c5dfbbe4363d
files tests/test-check-sdist.t tests/test-evolve-inmemory.t
diffstat 2 files changed, 126 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-check-sdist.t	Thu Oct 15 15:16:36 2020 -0700
+++ b/tests/test-check-sdist.t	Thu Oct 01 12:34:36 2020 -0700
@@ -27,7 +27,7 @@
 
   $ tar -tzf hg-evolve-*.tar.gz | sed 's|^hg-evolve-[^/]*/||' | sort > files
   $ wc -l files
-  343 files
+  344 files
   $ fgrep debian files
   tests/test-check-debian.t
   $ fgrep __init__.py files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-inmemory.t	Thu Oct 01 12:34:36 2020 -0700
@@ -0,0 +1,125 @@
+Tests running `hg evolve` with in-memory merge.
+
+  $ . $TESTDIR/testlib/common.sh
+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > evolve =
+  > drawdag=$RUNTESTDIR/drawdag.py
+  > [alias]
+  > glog = log -G -T '{rev}:{node|short} {separate(" ", phase, tags)}\n{desc|firstline}'
+  > EOF
+
+Test evolving a single orphan
+
+  $ hg init single-orphan
+  $ cd single-orphan
+  $ hg debugdrawdag <<'EOS'
+  >     C  # C/c = c\n
+  > B2  |  # B2/b = b2\n
+  > |   B  # B/b = b\n
+  >  \ /   # replace: B -> B2
+  >   A
+  > EOS
+  1 new orphan changesets
+  $ hg evolve
+  move:[3] C
+  atop:[2] B2
+  $ hg glog
+  o  4:52da76e91abb draft tip
+  |  C
+  | x  3:bc77848cde3a draft C
+  | |  C
+  o |  2:377a194b9b8a draft B2
+  | |  B2
+  | x  1:830b6315076c draft B
+  |/   B
+  o  0:426bada5c675 draft A
+     A
+  $ hg cat -r tip b c
+  b2
+  c
+  $ cd ..
+
+Test that in-memory evolve works when there are conflicts
+and after continuing.
+
+  $ hg init conflicts
+  $ cd conflicts
+  $ hg debugdrawdag <<'EOS'
+  >     E  # E/e = e\n
+  >     |
+  >     D  # D/b = d\n
+  >     |
+  >     C  # C/c = c\n
+  > B2  |  # B2/b = b2\n
+  > |   B  # B/b = b\n
+  >  \ /   # replace: B -> B2
+  >   A
+  > EOS
+  3 new orphan changesets
+  $ hg evolve
+  move:[3] C
+  atop:[2] B2
+  move:[4] D
+  merging b
+  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
+  unresolved merge conflicts
+  (see 'hg help evolve.interrupted')
+  [240]
+  $ hg glog
+  @  6:52da76e91abb draft tip
+  |  C
+  | *  5:eae7899dd92b draft E
+  | |  E
+  | %  4:57e51f6a6d36 draft D
+  | |  D
+  | x  3:bc77848cde3a draft C
+  | |  C
+  o |  2:377a194b9b8a draft B2
+  | |  B2
+  | x  1:830b6315076c draft B
+  |/   B
+  o  0:426bada5c675 draft A
+     A
+  $ cat c
+  c
+  $ cat b
+  <<<<<<< destination: 52da76e91abb - test: C
+  b2
+  =======
+  d
+  >>>>>>> evolving:    57e51f6a6d36 D - test: D
+  $ echo d2 > b
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  evolving 4:57e51f6a6d36 "D"
+  move:[5] E
+  atop:[7] D
+  working directory is now at 000000000000
+  $ hg glog
+  o  8:3c658574f8ed draft tip
+  |  E
+  o  7:16e609b952e8 draft
+  |  D
+  o  6:52da76e91abb draft
+  |  C
+  | x  5:eae7899dd92b draft E
+  | |  E
+  | x  4:57e51f6a6d36 draft D
+  | |  D
+  | x  3:bc77848cde3a draft C
+  | |  C
+  o |  2:377a194b9b8a draft B2
+  | |  B2
+  | x  1:830b6315076c draft B
+  |/   B
+  o  0:426bada5c675 draft A
+     A
+  $ hg cat -r tip b c e
+  d2
+  c
+  e
+  $ cd ..