split: make sure hg split preserve the phase of splitting cset (issue6048) stable
authorSushil khanchi <sushilkhanchi97@gmail.com>
Sat, 02 Mar 2019 01:43:14 +0530
branchstable
changeset 4410 8087e9a0f902
parent 4409 2a593d8f07e7
child 4411 8ff5e557432a
child 4419 1fdecdfd0df9
split: make sure hg split preserve the phase of splitting cset (issue6048) Before this patch, while splitting we were not taking the phase of splitting cset into account. By default new commits would have draft changes. As we know there can two possible phases i.e draft and secret in rewriting csets thing, so this adds the handling of secret phase (as default is draft) Changes in test file reflect the added behaviour.
hgext3rd/evolve/cmdrewrite.py
tests/test-split.t
--- a/hgext3rd/evolve/cmdrewrite.py	Sat Mar 02 01:37:04 2019 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py	Sat Mar 02 01:43:14 2019 +0530
@@ -1182,6 +1182,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	Sat Mar 02 01:37:04 2019 +0530
+++ b/tests/test-split.t	Sat Mar 02 01:43:14 2019 +0530
@@ -1185,7 +1185,7 @@
   continue splitting? [Ycdq?] c
 
   $ hg glog --git -p
-  @  3:1f8c09b13fa2 split2 (draft)
+  @  3:1f8c09b13fa2 split2 (secret)
   |  diff --git a/c b/c
   |  new file mode 100644
   |  --- /dev/null
@@ -1193,7 +1193,7 @@
   |  @@ -0,0 +1,1 @@
   |  +c
   |
-  o  2:bcba06966846 split1 (draft)
+  o  2:bcba06966846 split1 (secret)
   |  diff --git a/b b/b
   |  new file mode 100644
   |  --- /dev/null