Patchwork [1,of,2,STABLE] histedit: fix serializing of None backupfile

mail settings
Submitter Durham Goode
Date May 7, 2015, 9:01 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/8953/
State Accepted
Headers show


Durham Goode - May 7, 2015, 9:01 p.m.
# HG changeset patch
# User Durham Goode <>
# Date 1430519327 25200
#      Fri May 01 15:28:47 2015 -0700
# Node ID ed5036b584c85b9cb63bfd0b6f0146a5e9316ab0
# Parent  c5d4f9cc8da7bb2068457e96e4f74ff694514ced
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.


diff --git a/hgext/ b/hgext/
--- a/hgext/
+++ b/hgext/
@@ -252,7 +252,10 @@  class histeditstate(object):
         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)
     def _load(self):