[PATCH 1 of 4] commit: prevent to close non head changesets

Gilles Moris gilles.moris at free.fr
Wed May 12 03:15:52 CDT 2010


# HG changeset patch
# User Gilles Moris <gilles.moris at free.fr>
# Date 1273473816 -7200
# Node ID fb42a17f51be019620d18aa277182a92e79d2d7b
# Parent  3a75a6f6d3fd92f3568ec7cb978187a18512a99d
commit: prevent to close non head changesets

diff -r 3a75a6f6d3fd -r fb42a17f51be mercurial/commands.py
--- a/mercurial/commands.py	Tue May 04 09:57:16 2010 +0200
+++ 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'):


More information about the Mercurial-devel mailing list