[PATCH 2 of 5] histedit: break _histedit function into smaller pieces (add _editplanaction)
Kostia Balytskyi
ikostia at fb.com
Mon Feb 1 17:54:01 UTC 2016
# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1454335958 0
# Mon Feb 01 14:12:38 2016 +0000
# Branch stable
# Node ID 2728f0ff3f167be2489fd8857fac536a4d937883
# Parent b4134e9230c252eb36e041a2fee5b1d0ed32db0f
histedit: break _histedit function into smaller pieces (add _editplanaction)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1035,24 +1035,7 @@
state.read()
state = bootstrapcontinue(ui, state, opts)
elif goal == 'edit-plan':
- state.read()
- if not rules:
- comment = geteditcomment(node.short(state.parentctxnode),
- node.short(state.topmost))
- rules = ruleeditor(repo, ui, state.actions, comment)
- else:
- if rules == '-':
- f = sys.stdin
- else:
- f = open(rules)
- rules = f.read()
- f.close()
- actions = parserules(rules, state)
- ctxs = [repo[act.nodetoverify()] \
- for act in state.actions if act.nodetoverify()]
- warnverifyactions(ui, repo, actions, state, ctxs)
- state.actions = actions
- state.write()
+ _editplanaction(ui, repo, state, rules)
return
elif goal == 'abort':
_abortaction(ui, repo, state)
@@ -1214,6 +1197,26 @@
finally:
state.clear()
+def _editplanaction(ui, repo, state, rules):
+ state.read()
+ if not rules:
+ comment = geteditcomment(node.short(state.parentctxnode),
+ node.short(state.topmost))
+ rules = ruleeditor(repo, ui, state.actions, comment)
+ else:
+ if rules == '-':
+ f = sys.stdin
+ else:
+ f = open(rules)
+ rules = f.read()
+ f.close()
+ actions = parserules(rules, state)
+ ctxs = [repo[act.nodetoverify()] \
+ for act in state.actions if act.nodetoverify()]
+ warnverifyactions(ui, repo, actions, state, ctxs)
+ state.actions = actions
+ state.write()
+
def bootstrapcontinue(ui, state, opts):
repo = state.repo
if state.actions:
More information about the Mercurial-devel
mailing list