changeset 3498:152daa6967af

evolve: add comptability to read old evolvestate files When a user runs `hg evolve` with old evolve where we used to write evolvestate the old ways i.e. without using cbor, and faces conflicts, the evolve is interrupted. If the user updates evolve before completing the evolve, that can result in traceback as the new evolve cannot read the old evolvestate file. The previous patch added function to read old evolvestate file and this patch uses that when we encounter the above mentioned case.
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 30 Jan 2018 15:11:35 +0530
parents dae819761c0e
children 512706514555
files hgext3rd/evolve/state.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/state.py	Tue Jan 30 15:02:40 2018 +0530
+++ b/hgext3rd/evolve/state.py	Tue Jan 30 15:11:35 2018 +0530
@@ -51,7 +51,12 @@
     def load(self):
         """load the existing evolvestate file into the class object"""
         op = self._read()
-        self.opts.update(op)
+        if isinstance(op, dict):
+            self.opts.update(op)
+        elif self.path == 'evolvestate':
+            # it is the old evolvestate file
+            oldop = _oldevolvestateread(self._repo)
+            self.opts.update(oldop)
 
     def addopts(self, opts):
         """add more key-value pairs to the data stored by the object"""