diff tests/test-branches.t @ 42542:2e1d9414ff71

commit: add --force-close-branch flag to close a non-head changeset While closing branch from a changeset which is not a branch head current implementation abort this action in every case but, there can be the situations where the changeset is not a local head but could be a remote head. This patch adds the functionality to bypass the "abort: can only close branch heads" by introducing --force-close-branch flag. Test case changes demonstrate the new functionality added. Differential Revision: https://phab.mercurial-scm.org/D6490
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sat, 18 May 2019 15:44:23 +0530
parents 9f7cb777b654
children 8d72e29ad1e0
line wrap: on
line diff
--- a/tests/test-branches.t	Fri Jun 28 21:31:34 2019 +0530
+++ b/tests/test-branches.t	Sat May 18 15:44:23 2019 +0530
@@ -958,6 +958,7 @@
 it should abort:
   $ hg ci -m "closing branch" --close-branch
   abort: can only close branch heads
+  (use --force-close-branch to close branch from a non-head changeset)
   [255]
 
   $ hg up 0
@@ -972,3 +973,18 @@
   @  0: 9092f1db7931 added a
      	default
   
+Test --force-close-branch to close a branch from a non-head changeset:
+---------------------------------------------------------------------
+
+  $ hg show stack --config extensions.show=
+    o  1553 added c
+    o  5f6d added b
+    @  9092 added a
+
+  $ hg ci -m "branch closed" --close-branch
+  abort: can only close branch heads
+  (use --force-close-branch to close branch from a non-head changeset)
+  [255]
+
+  $ hg ci -m "branch closed" --force-close-branch
+  created new head