histedit: change state format to allow non-hash lines

The existing state serialization format assumed the rule line consisted of an
action and a hash. In our external extension that adds 'exec' this is not the
case (there is no hash, just the shell command). So let's change the format to
be more generic with just an action and a remainder, and the various commands
can handle it as they wish.

Flagged for stable since we want to get this format tweak in before the new
format goes live in the release.
This commit is contained in:
Durham Goode 2015-04-17 09:46:43 -07:00
parent c5804a09d6
commit 71ec25235f

View File

@ -246,7 +246,8 @@ class histeditstate(object):
fp.write('%s\n' % self.keep)
fp.write('%d\n' % len(self.rules))
for rule in self.rules:
fp.write('%s%s\n' % (rule[1], rule[0]))
fp.write('%s\n' % rule[0]) # action
fp.write('%s\n' % rule[1]) # remainder
fp.write('%d\n' % len(self.replacements))
for replacement in self.replacements:
fp.write('%s%s\n' % (node.hex(replacement[0]), ''.join(node.hex(r)
@ -276,11 +277,11 @@ class histeditstate(object):
rulelen = int(lines[index])
index += 1
for i in xrange(rulelen):
rule = lines[index]
rulehash = rule[:40]
ruleaction = rule[40:]
rules.append((ruleaction, rulehash))
ruleaction = lines[index]
index += 1
rule = lines[index]
index += 1
rules.append((ruleaction, rule))
# Replacements
replacements = []