--- a/hgext3rd/evolve/cmdrewrite.py Fri Feb 22 21:01:06 2019 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py Sun Mar 03 16:29:32 2019 +0100
@@ -1172,6 +1172,10 @@
rewriteutil.precheck(repo, [rev], action='split')
tr = repo.transaction('split')
+ # make sure we respect the revision current phase while splitting
+ phasestr = ctx.phasestr()
+ if phasestr == 'secret':
+ opts['secret'] = True
if len(ctx.parents()) > 1:
raise error.Abort(_("cannot split merge commits"))
prev = ctx.p1()
--- a/tests/test-split.t Fri Feb 22 21:01:06 2019 +0530
+++ b/tests/test-split.t Sun Mar 03 16:29:32 2019 +0100
@@ -1118,3 +1118,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 (secret)
+ | diff --git a/c b/c
+ | new file mode 100644
+ | --- /dev/null
+ | +++ b/c
+ | @@ -0,0 +1,1 @@
+ | +c
+ |
+ o 2:bcba06966846 split1 (secret)
+ | 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
+