histedit: fix serializing of None backupfile stable
authorDurham Goode <durham@fb.com>
Fri, 01 May 2015 15:28:47 -0700
branchstable
changeset 24958 a920abf5a592
parent 24952 169d2470d283
child 24959 3c762cceedde
histedit: fix serializing of None backupfile If the histedit backupfile was None (like if evolve is enabled) it would get serialized as 'None' into the state file. Later if the histedit was aborted and the top most commit was unreachable (ex: if it was obsolete or stripped), histedit would try to unbundle the backupfile and try to read .hg/None. This fixes it to not serialize None. Since it only happens with evolve, I'm not sure how to add test coverage here.
hgext/histedit.py
--- a/hgext/histedit.py	Thu May 07 07:46:39 2015 +0900
+++ b/hgext/histedit.py	Fri May 01 15:28:47 2015 -0700
@@ -252,7 +252,10 @@
         for replacement in self.replacements:
             fp.write('%s%s\n' % (node.hex(replacement[0]), ''.join(node.hex(r)
                 for r in replacement[1])))
-        fp.write('%s\n' % self.backupfile)
+        backupfile = self.backupfile
+        if not backupfile:
+            backupfile = ''
+        fp.write('%s\n' % backupfile)
         fp.close()
 
     def _load(self):