diff hgext3rd/evolve/__init__.py @ 3457:82e9f9603b1b

evolvestate: rename the file to state.py and class name to cmdstate The evolvestate.py and the evolvestate class in it were introduced to help `hg evolve` grow continue and abort options. But the class and it's API can be easily used to store state information for other state files like we stored the information for grab state in the previous commit. Let's rename the the file and class.
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 17 Jan 2018 19:12:32 +0530
parents b03d955e391e
children 210132852a3d
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Fri Jan 26 17:55:16 2018 +0100
+++ b/hgext3rd/evolve/__init__.py	Wed Jan 17 19:12:32 2018 +0530
@@ -310,7 +310,7 @@
     compat,
     debugcmd,
     cmdrewrite,
-    evolvestate,
+    state,
     exthelper,
     metadata,
     obscache,
@@ -840,8 +840,8 @@
         raise
 
 def summaryhook(ui, repo):
-    state = evolvestate.evolvestate(repo)
-    if state:
+    evolvestate = state.cmdstate(repo)
+    if evolvestate:
         # i18n: column positioning for "hg summary"
         ui.status(_('evolve: (evolve --continue)\n'))
 
@@ -1571,11 +1571,11 @@
 
     # Continuation handling
     if contopt:
-        state = evolvestate.evolvestate(repo)
-        if not state:
+        evolvestate = state.cmdstate(repo)
+        if not evolvestate:
             raise error.Abort('no evolve to continue')
-        state.load()
-        orig = repo[state['current']]
+        evolvestate.load()
+        orig = repo[evolvestate['current']]
         with repo.wlock(), repo.lock():
             ctx = orig
             source = ctx.extra().get('source')
@@ -1598,7 +1598,7 @@
                                    date=date, extra=extra)
 
             obsolete.createmarkers(repo, [(ctx, (repo[node],))])
-            state.delete()
+            evolvestate.delete()
             return
 
     cmdutil.bailifchanged(repo)
@@ -1784,8 +1784,8 @@
             relocate(repo, orig, target, pctx, keepbranch)
         except MergeFailure:
             ops = {'current': orig.node()}
-            state = evolvestate.evolvestate(repo, opts=ops)
-            state.save()
+            evolvestate = state.cmdstate(repo, opts=ops)
+            evolvestate.save()
             repo.ui.write_err(_('evolve failed!\n'))
             repo.ui.write_err(
                 _("fix conflict and run 'hg evolve --continue'"