[PATCH 4 of 8] histedit: move makedesc function near other rules related function
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Fri Sep 21 12:28:27 CDT 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1348180410 -7200
# Node ID 6923d7fab598e16f1c2d15faeeb67b8360759a4f
# Parent 10114dd8b02a1cc253e7101acbdeaa092ceab311
histedit: move makedesc function near other rules related function
Having it in the middle of action logic is confusing
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -280,24 +280,10 @@ def message(ui, repo, ctx, ha, opts):
if oldctx.node() != newctx.node():
return newctx, [new], [oldctx.node()], []
# We didn't make an edit, so just indicate no replaced nodes
return newctx, [new], [], []
-
-def makedesc(c):
- """build a initial action line for a ctx `c`
-
- line are in the form:
-
- pick <hash> <rev> <summary>
- """
- summary = ''
- if c.description():
- summary = c.description().splitlines()[0]
- line = 'pick %s %d %s' % (c.hex()[:12], c.rev(), summary)
- return line[:80] # trim to 80 chars so it's not stupidly wide in my editor
-
actiontable = {'p': pick,
'pick': pick,
'e': edit,
'edit': edit,
'f': fold,
@@ -639,10 +625,23 @@ def readstate(repo):
"""
fp = open(os.path.join(repo.path, 'histedit-state'))
return pickle.load(fp)
+def makedesc(c):
+ """build a initial action line for a ctx `c`
+
+ line are in the form:
+
+ pick <hash> <rev> <summary>
+ """
+ summary = ''
+ if c.description():
+ summary = c.description().splitlines()[0]
+ line = 'pick %s %d %s' % (c.hex()[:12], c.rev(), summary)
+ return line[:80] # trim to 80 chars so it's not stupidly wide in my editor
+
def verifyrules(rules, repo, ctxs):
"""Verify that there exists exactly one edit rule per given changeset.
Will abort if there are to many or too few rules, a malformed rule,
or a rule on a changeset outside of the user-given range.
More information about the Mercurial-devel
mailing list