diff tests/test-graft.t @ 24643:a8e6897dffbe

graft: allow creating sibling grafts Previously it was impossible to graft a commit onto it's own parent (i.e. create a copy of the commit). This is useful when wanting to create a backup of the commit before continuing to amend it. This patch enables that behavior. The change to the histedit test is because histedit uses graft to apply commits. The test in question moves a commit backwards onto an ancestor. Since the graft logic now more explicitly supports this, it knows to simply accept the incoming changes (since they are more recent), instead of prompting.
author Durham Goode <durham@fb.com>
date Sun, 05 Apr 2015 11:55:38 -0700
parents a43fdf33a6be
children 51930a7180bd
line wrap: on
line diff
--- a/tests/test-graft.t	Mon Apr 06 16:07:18 2015 -0700
+++ b/tests/test-graft.t	Sun Apr 05 11:55:38 2015 -0700
@@ -730,3 +730,29 @@
   $ hg graft -f 27
   grafting 27:3d35c4c79e5a "28"
   note: graft of 27:3d35c4c79e5a created no changes to commit
+
+  $ cd ..
+
+Graft to duplicate a commit
+
+  $ hg init graftsibling
+  $ cd graftsibling
+  $ touch a
+  $ hg commit -qAm a
+  $ touch b
+  $ hg commit -qAm b
+  $ hg log -G -T '{rev}\n'
+  @  1
+  |
+  o  0
+  
+  $ hg up -q 0
+  $ hg graft -r 1
+  grafting 1:0e067c57feba "b" (tip)
+  $ hg log -G -T '{rev}\n'
+  @  2
+  |
+  | o  1
+  |/
+  o  0
+