histedit: add forceother constraint
authorMateusz Kwapich <mitrandir@fb.com>
Thu, 12 Nov 2015 16:40:33 -0800
changeset 27083 6d5d7ac41ef4
parent 27082 4898e442f392
child 27084 383f10b67fd6
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.
hgext/histedit.py
--- a/hgext/histedit.py	Tue Nov 17 16:37:26 2015 -0800
+++ b/hgext/histedit.py	Thu Nov 12 16:40:33 2015 -0800
@@ -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'])
@@ -1087,6 +1088,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])