##// END OF EJS Templates
histedit: factor out logic of processing state data in separate fn...
Pulkit Goyal -
r38524:c6a2ce82 default
parent child Browse files
Show More
@@ -318,22 +318,29 b' class histeditstate(object):'
318 raise
318 raise
319 cmdutil.wrongtooltocontinue(self.repo, _('histedit'))
319 cmdutil.wrongtooltocontinue(self.repo, _('histedit'))
320
320
321 if state.startswith('v1\n'):
321 data = self._read(state)
322
323 self.parentctxnode = data['parentctxnode']
324 actions = parserules(data['rules'], self)
325 self.actions = actions
326 self.keep = data['keep']
327 self.topmost = data['topmost']
328 self.replacements = data['replacements']
329 self.backupfile = data['backupfile']
330
331 def _read(self, fp):
332 if fp.startswith('v1\n'):
322 data = self._load()
333 data = self._load()
323 parentctxnode, rules, keep, topmost, replacements, backupfile = data
334 parentctxnode, rules, keep, topmost, replacements, backupfile = data
324 else:
335 else:
325 data = pickle.loads(state)
336 data = pickle.loads(fp)
326 parentctxnode, rules, keep, topmost, replacements = data
337 parentctxnode, rules, keep, topmost, replacements = data
327 backupfile = None
338 backupfile = None
339 rules = "\n".join(["%s %s" % (verb, rest) for [verb, rest] in rules])
328
340
329 self.parentctxnode = parentctxnode
341 return {'parentctxnode': parentctxnode, "rules": rules, "keep": keep,
330 rules = "\n".join(["%s %s" % (verb, rest) for [verb, rest] in rules])
342 "topmost": topmost, "replacements": replacements,
331 actions = parserules(rules, self)
343 "backupfile": backupfile}
332 self.actions = actions
333 self.keep = keep
334 self.topmost = topmost
335 self.replacements = replacements
336 self.backupfile = backupfile
337
344
338 def write(self, tr=None):
345 def write(self, tr=None):
339 if tr:
346 if tr:
General Comments 0
You need to be logged in to leave comments. Login now