D6492: branch: add test covering the case when we have no branchheads to close

khanchi97 (Sushil khanchi) phabricator at mercurial-scm.org
Fri Jun 7 13:56:25 UTC 2019


khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6492

AFFECTED FILES
  tests/test-branches.t

CHANGE DETAILS

diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -987,3 +987,30 @@
 with --force
   $ hg ci -m "branch closed" --close-branch --force
   created new head
+
+Test which adds coverage for the case when we got no heads from branchheads():
+-----------------------------------------------------------------------------
+
+  $ hg up -r "desc('added c')"
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch feature
+  marked working directory as branch feature
+  (branches are permanent and global, did you want a bookmark?)
+
+  $ hg log -GT "{rev}: {node|short} {desc|firstline}\n\t{branch}\n\n"
+  _  3: 0c72c83f0f75 branch closed
+  |  	default
+  |
+  | @  2: 155349b645be added c
+  | |  	default
+  | |
+  | o  1: 5f6d8a4bf34a added b
+  |/   	default
+  |
+  o  0: 9092f1db7931 added a
+     	default
+  
+XXX: we could have a more specific message here that current branch has no heads
+  $ hg ci -m "closing branch" --close-branch
+  abort: can only close branch heads
+  [255]



To: khanchi97, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list