Mercurial > hg
comparison hgext/histedit.py @ 27541:69df2081aeb5
histedit: pass previous action to verify
author | timeless <timeless@mozdev.org> |
---|---|
date | Mon, 28 Dec 2015 22:52:48 +0000 |
parents | 88b32dcc25b6 |
children | bf0900d3819c |
comparison
equal
deleted
inserted
replaced
27540:9dcd55a63f0b | 27541:69df2081aeb5 |
---|---|
356 """Parses the given rule, returning an instance of the histeditaction. | 356 """Parses the given rule, returning an instance of the histeditaction. |
357 """ | 357 """ |
358 rulehash = rule.strip().split(' ', 1)[0] | 358 rulehash = rule.strip().split(' ', 1)[0] |
359 return cls(state, node.bin(rulehash)) | 359 return cls(state, node.bin(rulehash)) |
360 | 360 |
361 def verify(self): | 361 def verify(self, prev): |
362 """ Verifies semantic correctness of the rule""" | 362 """ Verifies semantic correctness of the rule""" |
363 repo = self.repo | 363 repo = self.repo |
364 ha = node.hex(self.node) | 364 ha = node.hex(self.node) |
365 try: | 365 try: |
366 self.node = repo[ha].node() | 366 self.node = repo[ha].node() |
1213 Will abort if there are to many or too few rules, a malformed rule, | 1213 Will abort if there are to many or too few rules, a malformed rule, |
1214 or a rule on a changeset outside of the user-given range. | 1214 or a rule on a changeset outside of the user-given range. |
1215 """ | 1215 """ |
1216 expected = set(c.hex() for c in ctxs) | 1216 expected = set(c.hex() for c in ctxs) |
1217 seen = set() | 1217 seen = set() |
1218 prev = None | |
1218 for action in actions: | 1219 for action in actions: |
1219 action.verify() | 1220 action.verify(prev) |
1221 prev = action | |
1220 constraints = action.constraints() | 1222 constraints = action.constraints() |
1221 for constraint in constraints: | 1223 for constraint in constraints: |
1222 if constraint not in _constraints.known(): | 1224 if constraint not in _constraints.known(): |
1223 raise error.Abort(_('unknown constraint "%s"') % constraint) | 1225 raise error.Abort(_('unknown constraint "%s"') % constraint) |
1224 | 1226 |