[PATCH 7 of 7 v2] tests: introduce test for rebasing on named branches with closed heads

Mads Kiilerich mads at kiilerich.com
Tue Jan 14 20:24:46 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1384634789 18000
#      Sat Nov 16 15:46:29 2013 -0500
# Node ID 7876013de139291d2949c7c8d87f195496c0b344
# Parent  f380b191e0855ccf2e1fcc836aa3bbb9a1e108d8
tests: introduce test for rebasing on named branches with closed heads

diff --git a/tests/test-rebase-named-branches.t b/tests/test-rebase-named-branches.t
--- a/tests/test-rebase-named-branches.t
+++ b/tests/test-rebase-named-branches.t
@@ -240,3 +240,97 @@ Rebasing descendant onto ancestor across
   @  0: 'A'
   
   $ cd ..
+
+Rebase to other head on branch
+
+Set up a case:
+
+  $ hg init case1
+  $ cd case1
+  $ touch f
+  $ hg ci -qAm0
+  $ hg branch -q b
+  $ echo >> f
+  $ hg ci -qAm 'b1'
+  $ hg up -qr -2
+  $ hg branch -qf b
+  $ hg ci -qm 'b2'
+  $ hg up -qr -3
+  $ hg branch -q c
+  $ hg ci -m 'c1'
+
+  $ hg tglog
+  @  3: 'c1' c
+  |
+  | o  2: 'b2' b
+  |/
+  | o  1: 'b1' b
+  |/
+  o  0: '0'
+  
+  $ hg clone -q . ../case2
+
+rebase 'b2' to another lower branch head
+
+  $ hg up -qr 2
+  $ hg rebase
+  nothing to rebase - working directory parent is also destination
+  [1]
+  $ hg tglog
+  o  3: 'c1' c
+  |
+  | @  2: 'b2' b
+  |/
+  | o  1: 'b1' b
+  |/
+  o  0: '0'
+  
+
+rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1')
+
+  $ cd ../case2
+  $ hg up -qr 1
+  $ hg rebase
+  saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-backup.hg (glob)
+  $ hg tglog
+  @  3: 'b1' b
+  |
+  | o  2: 'c1' c
+  | |
+  o |  1: 'b2' b
+  |/
+  o  0: '0'
+  
+
+rebase 'c1' to the branch head 'c2' that is closed
+
+  $ hg branch -qf c
+  $ hg ci -qm 'c2 closed' --close
+  $ hg up -qr 2
+  $ hg tglog
+  o  4: 'c2 closed' c
+  |
+  o  3: 'b1' b
+  |
+  | @  2: 'c1' c
+  | |
+  o |  1: 'b2' b
+  |/
+  o  0: '0'
+  
+  $ hg rebase
+  nothing to rebase - working directory parent is also destination
+  [1]
+  $ hg tglog
+  o  4: 'c2 closed' c
+  |
+  o  3: 'b1' b
+  |
+  | @  2: 'c1' c
+  | |
+  o |  1: 'b2' b
+  |/
+  o  0: '0'
+  
+
+  $ cd ..


More information about the Mercurial-devel mailing list