changeset 28144:ed6d650b7cb7

histedit: change string literals to constants in goal naming This is a part of bigger effort to refactor histedit with ultimate goal of understanding it.
author Kostia Balytskyi <ikostia@fb.com>
date Mon, 15 Feb 2016 10:48:36 +0000
parents c754996fd41f
children cfa0037448f4
files hgext/histedit.py
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Sun Feb 07 18:08:59 2016 +0900
+++ b/hgext/histedit.py	Mon Feb 15 10:48:36 2016 +0000
@@ -982,14 +982,19 @@
     finally:
         release(state.lock, state.wlock)
 
+goalcontinue = 'continue'
+goalabort = 'abort'
+goaleditplan = 'edit-plan'
+goalnew = 'new'
+
 def _getgoal(opts):
     if opts.get('continue'):
-        return 'continue'
+        return goalcontinue
     if opts.get('abort'):
-        return 'abort'
+        return goalabort
     if opts.get('edit_plan'):
-        return 'edit-plan'
-    return 'new'
+        return goaleditplan
+    return goalnew
 
 def _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs):
     # TODO only abort if we try to histedit mq patches, not just
@@ -1045,16 +1050,17 @@
     _validateargs(ui, repo, state, freeargs, opts, goal, rules, revs)
 
     # rebuild state
-    if goal == 'continue':
+    if goal == goalcontinue:
         state.read()
         state = bootstrapcontinue(ui, state, opts)
-    elif goal == 'edit-plan':
+    elif goal == goaleditplan:
         _editplanaction(ui, repo, state, rules)
         return
-    elif goal == 'abort':
+    elif goal == goalabort:
         _abortaction(ui, repo, state)
         return
     else:
+        # goal == goalnew
         _newaction(ui, repo, state, revs, freeargs, opts)
 
     _continueaction(ui, repo, state)