##// 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 346 def fromrule(cls, state, rule):
347 347 """Parses the given rule, returning an instance of the histeditaction.
348 348 """
349 repo = state.repo
350 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 356 try:
352 node = repo[rulehash].node()
357 self.node = repo[ha].node()
353 358 except error.RepoError:
354 raise error.Abort(_('unknown changeset %s listed') % rulehash[:12])
355 return cls(state, node)
359 raise error.Abort(_('unknown changeset %s listed')
360 % ha[:12])
356 361
357 362 def constraints(self):
358 363 """Return a set of constrains that this action should be verified for
@@ -1175,6 +1180,7 b' def verifyrules(rules, state, ctxs):'
1175 1180 if verb not in actiontable or verb.startswith('_'):
1176 1181 raise error.Abort(_('unknown action "%s"') % verb)
1177 1182 action = actiontable[verb].fromrule(state, rest)
1183 action.verify()
1178 1184 constraints = action.constraints()
1179 1185 for constraint in constraints:
1180 1186 if constraint not in _constraints.known():
General Comments 0
You need to be logged in to leave comments. Login now