branch: add tests which shows branch can be closed from a non-branchhead cset
authorSushil khanchi <sushilkhanchi97@gmail.com>
Tue, 16 Apr 2019 01:19:58 +0530
changeset 42201 258821f2d465
parent 42200 c4d96f4761d3
child 42202 8d14d91584f1
branch: add tests which shows branch can be closed from a non-branchhead cset This patch shows that we can close a branch even from a cset which is not a branch head. It was supposed to abort this operation. Next patch will be fixing the issue. Differential Revision: https://phab.mercurial-scm.org/D6281
tests/test-branches.t
--- a/tests/test-branches.t	Sat Apr 20 17:27:24 2019 +0100
+++ b/tests/test-branches.t	Tue Apr 16 01:19:58 2019 +0530
@@ -940,3 +940,38 @@
   0010: 56 46 78 69 00 00 00 01                         |VFxi....|
 
   $ cd ..
+
+Test to make sure that `--close-branch` only works on a branch head:
+--------------------------------------------------------------------
+  $ hg init closebranch
+  $ cd closebranch
+  $ for ch in a b c; do
+  > echo $ch > $ch
+  > hg add $ch
+  > hg ci -m "added "$ch
+  > done;
+
+  $ hg up -r "desc('added b')"
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+trying to close branch from a cset which is not a branch head
+it should abort:
+XXX: it should have aborted here
+  $ hg ci -m "closing branch" --close-branch
+  created new head
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
+  _  3: 006876ddd20e closing branch
+  |  	default
+  |
+  | o  2: 155349b645be added c
+  |/   	default
+  |
+  o  1: 5f6d8a4bf34a added b
+  |  	default
+  |
+  @  0: 9092f1db7931 added a
+     	default
+