##// END OF EJS Templates
cmdutil: introduce 'editform' to distinguish the purpose of commit text editing...
FUJIWARA Katsunori -
r21999:6ce282ed default
parent child Browse files
Show More
@@ -109,7 +109,8 b' def logmessage(ui, opts):'
109 (logfile, inst.strerror))
109 (logfile, inst.strerror))
110 return message
110 return message
111
111
112 def getcommiteditor(edit=False, finishdesc=None, extramsg=None, **opts):
112 def getcommiteditor(edit=False, finishdesc=None, extramsg=None,
113 editform='', **opts):
113 """get appropriate commit message editor according to '--edit' option
114 """get appropriate commit message editor according to '--edit' option
114
115
115 'finishdesc' is a function to be called with edited commit message
116 'finishdesc' is a function to be called with edited commit message
@@ -122,6 +123,9 b' def getcommiteditor(edit=False, finishde'
122 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
123 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
123 is automatically added.
124 is automatically added.
124
125
126 'editform' is a dot-separated list of names, to distinguish
127 the purpose of commit text editing.
128
125 'getcommiteditor' returns 'commitforceeditor' regardless of
129 'getcommiteditor' returns 'commitforceeditor' regardless of
126 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
130 'edit', if one of 'finishdesc' or 'extramsg' is specified, because
127 they are specific for usage in MQ.
131 they are specific for usage in MQ.
@@ -129,7 +133,10 b' def getcommiteditor(edit=False, finishde'
129 if edit or finishdesc or extramsg:
133 if edit or finishdesc or extramsg:
130 return lambda r, c, s: commitforceeditor(r, c, s,
134 return lambda r, c, s: commitforceeditor(r, c, s,
131 finishdesc=finishdesc,
135 finishdesc=finishdesc,
132 extramsg=extramsg)
136 extramsg=extramsg,
137 editform=editform)
138 elif editform:
139 return lambda r, c, s: commiteditor(r, c, s, editform=editform)
133 else:
140 else:
134 return commiteditor
141 return commiteditor
135
142
@@ -2175,12 +2182,13 b' def amend(ui, repo, commitfunc, old, ext'
2175 lockmod.release(lock, wlock)
2182 lockmod.release(lock, wlock)
2176 return newid
2183 return newid
2177
2184
2178 def commiteditor(repo, ctx, subs):
2185 def commiteditor(repo, ctx, subs, editform=''):
2179 if ctx.description():
2186 if ctx.description():
2180 return ctx.description()
2187 return ctx.description()
2181 return commitforceeditor(repo, ctx, subs)
2188 return commitforceeditor(repo, ctx, subs, editform=editform)
2182
2189
2183 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None):
2190 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None,
2191 editform=''):
2184 if not extramsg:
2192 if not extramsg:
2185 extramsg = _("Leave message empty to abort commit.")
2193 extramsg = _("Leave message empty to abort commit.")
2186 tmpl = repo.ui.config('committemplate', 'changeset', '').strip()
2194 tmpl = repo.ui.config('committemplate', 'changeset', '').strip()
General Comments 0
You need to be logged in to leave comments. Login now