diff hgext/histedit.py @ 24810:f5416657e661 stable

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.
author Durham Goode <durham@fb.com>
date Fri, 17 Apr 2015 09:46:43 -0700
parents a9d63d87b837
children 5045a003260b
line wrap: on
line diff
--- a/hgext/histedit.py	Fri Apr 17 15:42:20 2015 -0500
+++ b/hgext/histedit.py	Fri Apr 17 09:46:43 2015 -0700
@@ -246,7 +246,8 @@
         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 @@
         rulelen = int(lines[index])
         index += 1
         for i in xrange(rulelen):
+            ruleaction = lines[index]
+            index += 1
             rule = lines[index]
-            rulehash = rule[:40]
-            ruleaction = rule[40:]
-            rules.append((ruleaction, rulehash))
             index += 1
+            rules.append((ruleaction, rule))
 
         # Replacements
         replacements = []