##// END OF EJS Templates
histedt: use inheritance to override the constraints in 'base'...
Pierre-Yves David -
r29880:a485ec06 default
parent child Browse files
Show More
@@ -414,27 +414,19 b' class histeditaction(object):'
414 except error.RepoError:
414 except error.RepoError:
415 raise error.ParseError(_('unknown changeset %s listed')
415 raise error.ParseError(_('unknown changeset %s listed')
416 % ha[:12])
416 % ha[:12])
417 for constraint in self.constraints:
417 if self.node is not None:
418 if constraint not in _constraints.known():
418 self._verifynodeconstraints(prev, expected, seen)
419 raise error.ParseError(_('unknown constraint "%s"') %
420 constraint)
421
419
422 if self.node is not None:
420 def _verifynodeconstraints(self, prev, expected, seen):
423 constrs = self.constraints
421 # by default command need a node in the edited list
424 if _constraints.noother in constrs and self.node not in expected:
422 if self.node not in expected:
425 raise error.ParseError(
423 raise error.ParseError(_('%s "%s" changeset was not a candidate')
426 _('%s "%s" changeset was not a candidate')
424 % (self.verb, node.short(self.node)),
427 % (self.verb, node.short(self.node)),
425 hint=_('only use listed changesets'))
428 hint=_('only use listed changesets'))
426 # and only one command per node
429 if _constraints.forceother in constrs and self.node in expected:
427 if self.node in seen:
430 raise error.ParseError(
428 raise error.ParseError(_('duplicated command for changeset %s') %
431 _('%s "%s" changeset was not an edited list candidate')
429 node.short(self.node))
432 % (self.verb, node.short(self.node)),
433 hint=_('only use listed changesets'))
434 if _constraints.noduplicates in constrs and self.node in seen:
435 raise error.ParseError(_(
436 'duplicated command for changeset %s') %
437 node.short(self.node))
438
430
439 def torule(self):
431 def torule(self):
440 """build a histedit rule line for an action
432 """build a histedit rule line for an action
@@ -809,6 +801,13 b' class base(histeditaction):'
809 basectx = self.repo['.']
801 basectx = self.repo['.']
810 return basectx, []
802 return basectx, []
811
803
804 def _verifynodeconstraints(self, prev, expected, seen):
805 # base can only be use with a node not in the edited set
806 if self.node in expected:
807 msg = _('%s "%s" changeset was not an edited list candidate')
808 raise error.ParseError(msg % (self.verb, node.short(self.node)),
809 hint=_('only use listed changesets'))
810
812 @action(['_multifold'],
811 @action(['_multifold'],
813 _(
812 _(
814 """fold subclass used for when multiple folds happen in a row
813 """fold subclass used for when multiple folds happen in a row
General Comments 0
You need to be logged in to leave comments. Login now