rewind: add a test for rewinding a fold
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 17 Jun 2018 00:22:31 +0200
changeset 3865 b945f2dae587
parent 3864 0254c96ce108
child 3866 de42d00d6ee2
rewind: add a test for rewinding a fold The code already have basic support for case. However the result create orphan that will need to be improved. However, we keep this changeset simple.
hgext3rd/evolve/rewind.py
tests/test-rewind.t
--- a/hgext3rd/evolve/rewind.py	Sun Jun 17 01:36:30 2018 +0200
+++ b/hgext3rd/evolve/rewind.py	Sun Jun 17 00:22:31 2018 +0200
@@ -40,6 +40,13 @@
     new copies. This behavior can be disabled using `--as-divergence`, the
     current latest successors won't be affected and content-divergence will
     appears between them and the restored version of the obsolete changesets.
+
+    Current rought edges:
+
+      * fold: rewinding to only some of the initially folded changesets will be
+              problematic. The fold result is marked obsolete and the part not
+              rewinded too are "lost".  Please use --as-divergence when you
+              need to perform such operation.
     """
     unfi = repo.unfiltered()
 
--- a/tests/test-rewind.t	Sun Jun 17 01:36:30 2018 +0200
+++ b/tests/test-rewind.t	Sun Jun 17 00:22:31 2018 +0200
@@ -568,3 +568,87 @@
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     c_ROOT
   
+
+rewind a fold
+-------------
+
+setup
+`````
+
+  $ echo 'default-date = 3 0' >> $HGRCPATH
+
+note: the orphan creation is unfortunate, and should be fixed later.
+
+Actual Rewind
+`````````````
+
+  $ hg rewind --to '9576e80d6851+a0316c4c5417' --hidden
+  1 new orphan changesets
+  rewinded to 2 changesets
+  (1 changesets obsoleted)
+  working directory is now at d3bb9de71a17
+  $ 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'}
+  9576e80d6851ce79cd535e2dc5fa01b444d89a39 d3bb9de71a17a85301bce02abc13114d2bc11615 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  a0316c4c54179357e71d068fb8884678ebc7c351 73a1ac2e570de1f33bbea7d8260b00d5af1d30a7 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 73a1ac2e570de1f33bbea7d8260b00d5af1d30a7 d3bb9de71a17a85301bce02abc13114d2bc11615 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '46', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog -r -2:
+  o    73a1ac2e570d (8) c_CD0
+  |\
+  +---@  d3bb9de71a17 (7) c_CD0
+  | | |
+  x---+  4535d0af405c (6) c_CD0
+  |\| |    rewritten(meta, date, parent, content) as 73a1ac2e570d, d3bb9de71a17 using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  | | |
+  +---x  9576e80d6851 (5) c_CD0
+  | |      rewritten(meta, parent, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  | |      rewritten(meta, date) as d3bb9de71a17 using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
+  | |
+  | x  a0316c4c5417 (4) c_CD0
+  |/     rewritten(meta, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
+  |      rewritten(meta, date) as 73a1ac2e570d using rewind by test (Thu Jan 01 00:00:03 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
+  o  changeset:   8:73a1ac2e570d
+  |  tag:         tip
+  |  parent:      2:7e594302a05d
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:03 1970 +0000
+  |  summary:     c_CD0
+  |
+  | @  changeset:   7:d3bb9de71a17
+  | |  parent:      4:a0316c4c5417
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:03 1970 +0000
+  | |  instability: orphan
+  | |  summary:     c_CD0
+  | |
+  | x  changeset:   4:a0316c4c5417
+  |/   parent:      2:7e594302a05d
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:02 1970 +0000
+  |    obsolete:    split using rewind as 8:73a1ac2e570d, 7:d3bb9de71a17
+  |    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
+