changeset 11163:acd61dc44a39

commit: prevent closing non-head changesets
author Gilles Moris <gilles.moris@free.fr>
date Mon, 10 May 2010 08:43:36 +0200
parents d6f378562397
children e84600b0d81b
files mercurial/commands.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue May 11 17:13:35 2010 -0500
+++ b/mercurial/commands.py	Mon May 10 08:43:36 2010 +0200
@@ -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'):