##// END OF EJS Templates
histedit: add verify() to histeditaction...
Mateusz Kwapich -
r27202:2226cd4f default
parent child Browse files
Show More
@@ -346,13 +346,18 b' class histeditaction(object):'
346 def fromrule(cls, state, rule):
346 def fromrule(cls, state, rule):
347 """Parses the given rule, returning an instance of the histeditaction.
347 """Parses the given rule, returning an instance of the histeditaction.
348 """
348 """
349 repo = state.repo
350 rulehash = rule.strip().split(' ', 1)[0]
349 rulehash = rule.strip().split(' ', 1)[0]
350 return cls(state, node.bin(rulehash))
351
352 def verify(self):
353 """ Verifies semantic correctness of the rule"""
354 repo = self.repo
355 ha = node.hex(self.node)
351 try:
356 try:
352 node = repo[rulehash].node()
357 self.node = repo[ha].node()
353 except error.RepoError:
358 except error.RepoError:
354 raise error.Abort(_('unknown changeset %s listed') % rulehash[:12])
359 raise error.Abort(_('unknown changeset %s listed')
355 return cls(state, node)
360 % ha[:12])
356
361
357 def constraints(self):
362 def constraints(self):
358 """Return a set of constrains that this action should be verified for
363 """Return a set of constrains that this action should be verified for
@@ -1175,6 +1180,7 b' def verifyrules(rules, state, ctxs):'
1175 if verb not in actiontable or verb.startswith('_'):
1180 if verb not in actiontable or verb.startswith('_'):
1176 raise error.Abort(_('unknown action "%s"') % verb)
1181 raise error.Abort(_('unknown action "%s"') % verb)
1177 action = actiontable[verb].fromrule(state, rest)
1182 action = actiontable[verb].fromrule(state, rest)
1183 action.verify()
1178 constraints = action.constraints()
1184 constraints = action.constraints()
1179 for constraint in constraints:
1185 for constraint in constraints:
1180 if constraint not in _constraints.known():
1186 if constraint not in _constraints.known():
General Comments 0
You need to be logged in to leave comments. Login now