mercurial/commands.py
changeset 42202 8d14d91584f1
parent 42187 90d48c1c6224
child 42244 0f01394457a0
--- a/mercurial/commands.py	Tue Apr 16 01:19:58 2019 +0530
+++ b/mercurial/commands.py	Tue Apr 16 02:06:20 2019 +0530
@@ -1675,6 +1675,8 @@
 
         if 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'))
         elif opts.get('amend'):
             if (repo['.'].p1().branch() != branch and
                 repo['.'].p2().branch() != branch):