[PATCH 2 of 4 V2] histedit: add forceother constraint

Mateusz Kwapich mitrandir at fb.com
Tue Nov 17 19:55:50 CST 2015


# HG changeset patch
# User Mateusz Kwapich <mitrandir at fb.com>
# Date 1447375233 28800
#      Thu Nov 12 16:40:33 2015 -0800
# Node ID 95af815c48c366e984fb26d82c46ece30fe194e8
# Parent  2aa95a3b1dcb9921c65a74228306fc1693dbf1d2
histedit: add forceother constraint

For the future 'base' action in histedit we need a verification
constraint which will not allow using this action with changes
that are currently edited.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -340,6 +340,7 @@
            Available constraints:
                noduplicates - aborts if there are multiple rules for one node
                noother - abort if the node doesn't belong to edited stack
+               forceother - abort if the node does belong to edited stack
         """
 
         return set(['noduplicates', 'noother'])
@@ -1086,6 +1087,10 @@
                 raise error.Abort(
                     _('may not use "%s" with changesets '
                       'other than the ones listed') % verb)
+            if 'forceother' in constraints and ha in expected:
+                raise error.Abort(
+                    _('may not use "%s" with changesets '
+                      'within the edited list') % verb)
             if 'noduplicates' in constraints and ha in seen:
                 raise error.Abort(_('duplicated command for changeset %s') %
                         ha[:12])


More information about the Mercurial-devel mailing list