tests/test-rewind.t
changeset 4821 d8e36e60aea0
parent 4820 d842a4c6fc4a
child 4863 5cd7d16b8733
child 4899 c982e7fb5e7a
--- a/tests/test-rewind.t	Tue Jul 23 18:05:40 2019 +0800
+++ b/tests/test-rewind.t	Thu Jul 25 18:37:16 2019 +0800
@@ -970,3 +970,83 @@
   ~
 
   $ cd ..
+
+Rewind --keep
+=============
+
+  $ hg init rewind-keep
+  $ cd rewind-keep
+  $ echo root > root
+  $ hg ci -qAm 'root'
+
+  $ echo apple > a
+  $ echo banana > b
+  $ hg ci -qAm initial
+
+  $ hg rm b
+  $ echo apricot > a
+  $ echo coconut > c
+  $ hg add c
+  $ hg status
+  M a
+  A c
+  R b
+  $ hg amend -m amended
+  $ hg glf --hidden
+  @  2: amended (a c)
+  |
+  | x  1: initial (a b)
+  |/
+  o  0: root (root)
+  
+
+Clean wdir
+
+  $ hg rewind --keep --to 'desc("initial")' --hidden
+  rewinded to 1 changesets
+  (1 changesets obsoleted)
+  $ hg obslog
+  @    b4c97fddc16a (3) initial
+  |\
+  x |  2ea5be2f8751 (2) amended
+  |/     rewritten(description, meta, content) as b4c97fddc16a using rewind by test (Thu Jan 01 00:00:06 1970 +0000)
+  |
+  x  30704102d912 (1) initial
+       rewritten(description, content) as 2ea5be2f8751 using amend by test (Thu Jan 01 00:00:06 1970 +0000)
+       rewritten(meta) as b4c97fddc16a using rewind by test (Thu Jan 01 00:00:06 1970 +0000)
+  
+  $ hg glf --hidden
+  @  3: initial (a b)
+  |
+  | x  2: amended (a c)
+  |/
+  | x  1: initial (a b)
+  |/
+  o  0: root (root)
+  
+  $ hg st
+  M a
+  A c
+  R b
+
+Making wdir even more dirty
+
+  $ echo avocado > a
+  $ echo durian > d
+  $ hg st
+  M a
+  A c
+  R b
+  ? d
+
+No rewinding without --keep
+
+  $ hg rewind --to 'desc("amended")' --hidden
+  abort: uncommitted changes
+  [255]
+
+XXX: Unfortunately, even with --keep it's not allowed
+
+  $ hg rewind --keep --to 'desc("amended")' --hidden
+  abort: uncommitted changes
+  [255]