rewind: add a test for rewinding a split
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 17 Jun 2018 01:36:30 +0200
changeset 3864 0254c96ce108
parent 3863 c31be22d1d90
child 3865 b945f2dae587
rewind: add a test for rewinding a split There are no code change needed but it is worth testing on its own.
tests/test-rewind.t
--- a/tests/test-rewind.t	Sun Jun 17 00:33:43 2018 +0200
+++ b/tests/test-rewind.t	Sun Jun 17 01:36:30 2018 +0200
@@ -439,3 +439,132 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     c_ROOT
   
+  $ cd ..
+
+rewind a simple split
+---------------------
+
+Setup
+`````
+
+  $ hg clone rewind-testing-base rewind-testing-split-fold
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd rewind-testing-split-fold
+
+  $ echo C > C
+  $ echo D > D
+  $ hg add C D
+  $ hg ci -m 'c_CD0'
+  $ hg split << EOF
+  > y
+  > f
+  > d
+  > y
+  > EOF
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  adding C
+  adding D
+  diff --git a/C b/C
+  new file mode 100644
+  examine changes to 'C'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +C
+  record change 1/2 to 'C'? [Ynesfdaq?] f
+  
+  diff --git a/D b/D
+  new file mode 100644
+  examine changes to 'D'? [Ynesfdaq?] d
+  
+  created new head
+  Done splitting? [yN] y
+  $ hg log -G
+  @  changeset:   5:9576e80d6851
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:02 1970 +0000
+  |  summary:     c_CD0
+  |
+  o  changeset:   4:a0316c4c5417
+  |  parent:      2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:02 1970 +0000
+  |  summary:     c_CD0
+  |
+  o  changeset:   2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+  
+  $ hg debugobsolete
+  49fb7d900906b0a3d329e90da4dcb0a7582d3b6e a0316c4c54179357e71d068fb8884678ebc7c351 9576e80d6851ce79cd535e2dc5fa01b444d89a39 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '12', 'operation': 'split', 'user': 'test'}
+  $ hg obslog --all
+  @  9576e80d6851 (5) c_CD0
+  |
+  | o  a0316c4c5417 (4) c_CD0
+  |/
+  x  49fb7d900906 (3) c_CD0
+       rewritten(parent, content) as 9576e80d6851, a0316c4c5417 using split by test (Thu Jan 01 00:00:02 1970 +0000)
+  
+
+Actual rewind
+`````````````
+
+  $ hg rewind --hidden --to 'min(desc("c_CD0"))'
+  rewinded to 1 changesets
+  (2 changesets obsoleted)
+  working directory is now at 4535d0af405c
+  $ hg debugobsolete
+  49fb7d900906b0a3d329e90da4dcb0a7582d3b6e a0316c4c54179357e71d068fb8884678ebc7c351 9576e80d6851ce79cd535e2dc5fa01b444d89a39 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '12', 'operation': 'split', 'user': 'test'}
+  49fb7d900906b0a3d329e90da4dcb0a7582d3b6e 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 4 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '2', 'operation': 'rewind', 'user': 'test'}
+  9576e80d6851ce79cd535e2dc5fa01b444d89a39 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '14', 'operation': 'rewind', 'user': 'test'}
+  a0316c4c54179357e71d068fb8884678ebc7c351 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '10', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog
+  @    4535d0af405c (6) c_CD0
+  |\
+  | \
+  | |\
+  | x |  9576e80d6851 (5) c_CD0
+  |/ /     rewritten(meta, parent, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  | |
+  | x  a0316c4c5417 (4) c_CD0
+  |/     rewritten(meta, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  |
+  x  49fb7d900906 (3) c_CD0
+       rewritten(meta) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+       rewritten(parent, content) as 9576e80d6851, a0316c4c5417 using split by test (Thu Jan 01 00:00:02 1970 +0000)
+  
+  $ hg log -G
+  @  changeset:   6:4535d0af405c
+  |  tag:         tip
+  |  parent:      2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:02 1970 +0000
+  |  summary:     c_CD0
+  |
+  o  changeset:   2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B0
+  |
+  o  changeset:   1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_A0
+  |
+  o  changeset:   0:eba9c2249fe7
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     c_ROOT
+