changeset 42494:abd4783db5a7

commit: make the error message more specific while aborting branch closing Differential Revision: https://phab.mercurial-scm.org/D6493
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Tue, 16 Apr 2019 02:53:28 +0530
parents 9f7cb777b654
children 373aeede7352
files mercurial/commands.py tests/test-commit-amend.t
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Apr 16 02:33:54 2019 +0530
+++ b/mercurial/commands.py	Tue Apr 16 02:53:28 2019 +0530
@@ -1677,7 +1677,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:
             raise error.Abort(_('can only close branch heads'))
         elif opts.get('amend'):
--- a/tests/test-commit-amend.t	Tue Apr 16 02:33:54 2019 +0530
+++ b/tests/test-commit-amend.t	Tue Apr 16 02:53:28 2019 +0530
@@ -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