diff --git a/mercurial/commands.py b/mercurial/commands.py index d6f378562397b976c662a92284f89f19b75911ed_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..acd61dc44a397ead4eab09b9dd78b35f75cdb856_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644 --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -717,6 +717,10 @@ """ extra = {} if opts.get('close_branch'): + if repo['.'].node() not in repo.branchheads(): + # The topo heads set is included in the branch heads set of the + # current branch, so it's sufficient to test branchheads + raise util.Abort(_('can only close branch heads')) extra['close'] = 1 e = cmdutil.commiteditor if opts.get('force_editor'):