tests/test-split.t
branchstable
changeset 4409 2a593d8f07e7
parent 4345 f45b4c31d81f
child 4410 8087e9a0f902
--- a/tests/test-split.t	Mon Feb 11 21:33:02 2019 +0800
+++ b/tests/test-split.t	Sat Mar 02 01:37:04 2019 +0530
@@ -1116,3 +1116,96 @@
   |
   o  0:a5a1faba8d26 p (draft)
   
+  $ cd ..
+
+Testing that `hg split` preserve the phase of splitting cset(issue6048)
+-----------------------------------------------------------------------
+
+Prepare the repository:
+  $ hg init issue6048
+  $ cd issue6048
+  $ echo a > a
+  $ hg ci -Am "added a"
+  adding a
+
+  $ echo b > b
+  $ echo c > c
+  $ hg add b c
+  $ hg ci -m "added b c" --secret
+
+  $ hg glog -l1 -p --git
+  @  1:12e9cc39ba19 added b c (secret)
+  |  diff --git a/b b/b
+  ~  new file mode 100644
+     --- /dev/null
+     +++ b/b
+     @@ -0,0 +1,1 @@
+     +b
+     diff --git a/c b/c
+     new file mode 100644
+     --- /dev/null
+     +++ b/c
+     @@ -0,0 +1,1 @@
+     +c
+  
+To create commits with the number of split
+  $ echo 0 > num
+  $ cat > editor.sh << '__EOF__'
+  > NUM=$(cat num)
+  > NUM=`expr "$NUM" + 1`
+  > echo "$NUM" > num
+  > echo "split$NUM" > "$1"
+  > __EOF__
+  $ export HGEDITOR="\"sh\" \"editor.sh\""
+
+Splitting
+  $ hg split -r . << EOF
+  > y
+  > y
+  > n
+  > c
+  > EOF
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  adding b
+  adding c
+  diff --git a/b b/b
+  new file mode 100644
+  examine changes to 'b'? [Ynesfdaq?] y
+  
+  @@ -0,0 +1,1 @@
+  +b
+  record change 1/2 to 'b'? [Ynesfdaq?] y
+  
+  diff --git a/c b/c
+  new file mode 100644
+  examine changes to 'c'? [Ynesfdaq?] n
+  
+  created new head
+  (consider using topic for lightweight branches. See 'hg help topic')
+  continue splitting? [Ycdq?] c
+
+  $ hg glog --git -p
+  @  3:1f8c09b13fa2 split2 (draft)
+  |  diff --git a/c b/c
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/c
+  |  @@ -0,0 +1,1 @@
+  |  +c
+  |
+  o  2:bcba06966846 split1 (draft)
+  |  diff --git a/b b/b
+  |  new file mode 100644
+  |  --- /dev/null
+  |  +++ b/b
+  |  @@ -0,0 +1,1 @@
+  |  +b
+  |
+  o  0:9092f1db7931 added a (draft)
+     diff --git a/a b/a
+     new file mode 100644
+     --- /dev/null
+     +++ b/a
+     @@ -0,0 +1,1 @@
+     +a
+