Patchwork D6493: branch: make the error message more specific while aborting branch closing

login
register
mail settings
Submitter phabricator
Date June 7, 2019, 1:57 p.m.
Message ID <differential-rev-PHID-DREV-27y5xi7mk4vl7bwsfsri-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/40347/
State New
Headers show

Comments

phabricator - June 7, 2019, 1:57 p.m.
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/D6493

AFFECTED FILES
  mercurial/commands.py
  tests/test-commit-amend.t

CHANGE DETAILS




To: khanchi97, #hg-reviewers
Cc: mercurial-devel
phabricator - June 11, 2019, 2:06 p.m.
pulkit added a comment.


  This one fails to apply, seems like dependent on other related patches.

REPOSITORY
  rHG Mercurial

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

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

Patch

diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -892,7 +892,7 @@ 
   marked working directory as branch silliness
   $ echo b >> b
   $ hg ci --close-branch -m'open and close'
-  abort: can only close branch heads
+  abort: branch "silliness" has no heads to close
   [255]
 
 Test that amend with --secret creates new secret changeset forcibly
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1678,7 +1678,7 @@ 
             raise error.Abort(_('current revision is already a branch closing'
                                 ' head'))
         elif not bheads:
-            raise error.Abort(_('can only close branch heads'))
+            raise error.Abort(_('branch "%s" has no heads to close') % branch)
         elif (branch == repo['.'].branch() and repo['.'].node() not in bheads
               and not opts.get('force')):
             raise error.Abort(_('can only close branch heads'))