# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1515580063 -19800 # Node ID 62f33ed3c36ca6c0d2b2cd7f6d2ef4c2a98c7413 # Parent d2fc2c2783f8df8acf3dde9781bbf7e6d799eb1d evolve: use the new evolvestate class in place of old methods Earlier we had three methods, which used to handle all the storage around the evolvestate but in previous patch we have introduced an evolvestate class wrapper which can serve for all our needs. This patch replaces the existing usage of the evolvestate with the new class introduced. Upcoming patches will start using the class at more places. diff -r d2fc2c2783f8 -r 62f33ed3c36c hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Wed Jan 10 14:53:01 2018 +0530 +++ b/hgext3rd/evolve/__init__.py Wed Jan 10 15:57:43 2018 +0530 @@ -313,6 +313,7 @@ compat, debugcmd, cmdrewrite, + evolvestate, exthelper, metadata, obscache, @@ -849,8 +850,8 @@ raise def summaryhook(ui, repo): - state = _evolvestateread(repo) - if state is not None: + state = evolvestate.evolvestate(repo) + if state: # i18n: column positioning for "hg summary" ui.status(_('evolve: (evolve --continue)\n')) @@ -1580,9 +1581,10 @@ # Continuation handling if contopt: - state = _evolvestateread(repo) - if state is None: + state = evolvestate.evolvestate(repo) + if not state: raise error.Abort('no evolve to continue') + state.load() orig = repo[state['current']] with repo.wlock(), repo.lock(): ctx = orig @@ -1606,7 +1608,7 @@ date=date, extra=extra) obsolete.createmarkers(repo, [(ctx, (repo[node],))]) - _evolvestatedelete(repo) + state.delete() return cmdutil.bailifchanged(repo) @@ -1791,7 +1793,9 @@ try: relocate(repo, orig, target, pctx, keepbranch) except MergeFailure: - _evolvestatewrite(repo, {'current': orig.node()}) + ops = {'current': orig.node()} + state = evolvestate.evolvestate(repo, opts=ops) + state.save() repo.ui.write_err(_('evolve failed!\n')) repo.ui.write_err( _("fix conflict and run 'hg evolve --continue'"