diff mercurial/commands.py @ 42493:9f7cb777b654

commit: add a check if it is trying to close an already closed branch head It would check if the revision we are going to close is already a closed branch head and print the error message accordingly. Differential Revision: https://phab.mercurial-scm.org/D6491
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Tue, 16 Apr 2019 02:33:54 +0530
parents 1314c0bb6b24
children abd4783db5a7
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Jun 17 10:53:00 2019 -0700
+++ b/mercurial/commands.py	Tue Apr 16 02:33:54 2019 +0530
@@ -1673,7 +1673,10 @@
     if opts.get('close_branch'):
         extra['close'] = '1'
 
-        if not bheads:
+        if repo['.'].closesbranch():
+            raise error.Abort(_('current revision is already a branch closing'
+                                ' head'))
+        elif not bheads:
             raise error.Abort(_('can only close branch heads'))
         elif branch == repo['.'].branch() and repo['.'].node() not in bheads:
             raise error.Abort(_('can only close branch heads'))