changeset 3860:fa184c5edfe8

rewind: test rewinding an amended changesets We are now able to rewind a simple amended changeset. For now, its current successors has not been obsoleted and we created divergence.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 16 Jun 2018 23:32:22 +0200
parents 6e3d844b56f2
children bbe635dfd75c
files tests/test-rewind.t
diffstat 1 files changed, 130 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-rewind.t	Sun Jun 17 00:57:09 2018 +0200
+++ b/tests/test-rewind.t	Sat Jun 16 23:32:22 2018 +0200
@@ -225,3 +225,133 @@
      summary:     c_ROOT
   
   $ cd ..
+
+rewind a simple amend - creating content-divergence
+---------------------------------------------------
+
+Setup
+`````
+
+  $ hg clone rewind-testing-base rewind-testing-single-rewrite
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd rewind-testing-single-rewrite
+  $ echo BB > B
+  $ hg amend -m 'c_B1'
+  $ hg log -G
+  @  changeset:   3:25c8f5ab0c3b
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B1
+  |
+  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
+  
+
+Actual rewind
+`````````````
+
+  $ hg rewind --hidden --to 'desc("c_B0")'
+  2 new content-divergent changesets
+  rewinded to 1 changesets
+  $ hg debugobsolete
+  7e594302a05d3769b27be88fc3cdfd39d7498498 25c8f5ab0c3bb569ec672570f1a901be4c6f032b 0 (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
+  7e594302a05d3769b27be88fc3cdfd39d7498498 48acf2c0d9c8961859ce9a913671eb2adc9b057b 4 (Thu Jan 01 00:00:01 1970 +0000) {'ef1': '34', 'operation': 'rewind', 'user': 'test'}
+  $ hg obslog --rev 'desc("c_B0")'
+  *  48acf2c0d9c8 (4) c_B0
+  |
+  x  7e594302a05d (2) c_B0
+       rewritten(description, content) as 25c8f5ab0c3b using amend by test (Thu Jan 01 00:00:01 1970 +0000)
+       rewritten(meta, date) as 48acf2c0d9c8 using rewind by test (Thu Jan 01 00:00:01 1970 +0000)
+  
+  $ hg log -G
+  *  changeset:   4:48acf2c0d9c8
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:01 1970 +0000
+  |  instability: content-divergent
+  |  summary:     c_B0
+  |
+  | @  changeset:   3:25c8f5ab0c3b
+  |/   parent:      1:579f120ba918
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    instability: content-divergent
+  |    summary:     c_B1
+  |
+  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 log -G --hidden
+  *  changeset:   4:48acf2c0d9c8
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:01 1970 +0000
+  |  instability: content-divergent
+  |  summary:     c_B0
+  |
+  | @  changeset:   3:25c8f5ab0c3b
+  |/   parent:      1:579f120ba918
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    instability: content-divergent
+  |    summary:     c_B1
+  |
+  | x  changeset:   2:7e594302a05d
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    obsolete:    rewritten using rewind as 4:48acf2c0d9c8
+  |    obsolete:    rewritten using amend as 3:25c8f5ab0c3b
+  |    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
+  
+
+Cleanup
+```````
+  $ hg prune 'max(desc("c_B0"))'
+  1 changesets pruned
+  $ hg log -G
+  @  changeset:   3:25c8f5ab0c3b
+  |  tag:         tip
+  |  parent:      1:579f120ba918
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     c_B1
+  |
+  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
+