[PATCH 2 of 2] histedit: renaming parts to which _histedit was split

Kostia Balytskyi ikostia at fb.com
Mon Feb 15 10:03:58 EST 2016


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1455548226 0
#      Mon Feb 15 14:57:06 2016 +0000
# Node ID c6802ffe9c05724d8906ce6906120723f3e516dd
# Parent  5f4766e10d8dae1a1a3cbc1a9ff1c15c852f0005
histedit: renaming parts to which _histedit was split

I recently broke _histedit into multiple functions, each of which
had 'action' in its name. This is a little bit confusing since 'action'
is the word for an individual histedit plan item (such as edit or pick).
To avoid this confusion, these functions are now renamed to contain
'histedit' as part of their names.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1054,22 +1054,22 @@
         state.read()
         state = bootstrapcontinue(ui, state, opts)
     elif goal == goaleditplan:
-        _editplanaction(ui, repo, state, rules)
+        _edithisteditplan(ui, repo, state, rules)
         return
     elif goal == goalabort:
-        _abortaction(ui, repo, state)
+        _aborthistedit(ui, repo, state)
         return
     else:
         # goal == goalnew
-        _newaction(ui, repo, state, revs, freeargs, opts)
+        _newhistedit(ui, repo, state, revs, freeargs, opts)
 
-    _continueaction(ui, repo, state)
-    _finishaction(ui, repo, state)
+    _continuehistedit(ui, repo, state)
+    _finishhistedit(ui, repo, state)
 
-def _continueaction(ui, repo, state):
-    """This action runs after either:
+def _continuehistedit(ui, repo, state):
+    """This function runs after either:
     - bootstrapcontinue (if the goal is 'continue')
-    - _newaction (if the goal is 'new')
+    - _newhistedit (if the goal is 'new')
     """
     # preprocess rules so that we can hide inner folds from the user
     # and only show one editor
@@ -1095,7 +1095,7 @@
     state.write()
     ui.progress(_("editing"), None)
 
-def _finishaction(ui, repo, state):
+def _finishhistedit(ui, repo, state):
     """This action runs when histedit is finishing its session"""
     repo.ui.pushbuffer()
     hg.update(repo, state.parentctxnode, quietempty=True)
@@ -1144,7 +1144,7 @@
     if repo.vfs.exists('histedit-last-edit.txt'):
         repo.vfs.unlink('histedit-last-edit.txt')
 
-def _abortaction(ui, repo, state):
+def _aborthistedit(ui, repo, state):
     try:
         state.read()
         tmpnodes, leafs = newnodestoabort(state)
@@ -1181,7 +1181,7 @@
     finally:
             state.clear()
 
-def _editplanaction(ui, repo, state, rules):
+def _edithisteditplan(ui, repo, state, rules):
     state.read()
     if not rules:
         comment = geteditcomment(node.short(state.parentctxnode),
@@ -1201,7 +1201,7 @@
     state.actions = actions
     state.write()
 
-def _newaction(ui, repo, state, revs, freeargs, opts):
+def _newhistedit(ui, repo, state, revs, freeargs, opts):
     outg = opts.get('outgoing')
     rules = opts.get('commands', '')
     force = opts.get('force')


More information about the Mercurial-devel mailing list