Show More
@@ -2170,6 +2170,23 b' def commiteditor(repo, ctx, subs):' | |||
|
2170 | 2170 | return commitforceeditor(repo, ctx, subs) |
|
2171 | 2171 | |
|
2172 | 2172 | def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None): |
|
2173 | committext = buildcommittext(repo, ctx, subs, extramsg) | |
|
2174 | ||
|
2175 | # run editor in the repository root | |
|
2176 | olddir = os.getcwd() | |
|
2177 | os.chdir(repo.root) | |
|
2178 | text = repo.ui.edit(committext, ctx.user(), ctx.extra()) | |
|
2179 | text = re.sub("(?m)^HG:.*(\n|$)", "", text) | |
|
2180 | os.chdir(olddir) | |
|
2181 | ||
|
2182 | if finishdesc: | |
|
2183 | text = finishdesc(text) | |
|
2184 | if not text.strip(): | |
|
2185 | raise util.Abort(_("empty commit message")) | |
|
2186 | ||
|
2187 | return text | |
|
2188 | ||
|
2189 | def buildcommittext(repo, ctx, subs, extramsg): | |
|
2173 | 2190 | edittext = [] |
|
2174 | 2191 | modified, added, removed = ctx.modified(), ctx.added(), ctx.removed() |
|
2175 | 2192 | if ctx.description(): |
@@ -2197,19 +2214,8 b' def commitforceeditor(repo, ctx, subs, f' | |||
|
2197 | 2214 | if not added and not modified and not removed: |
|
2198 | 2215 | edittext.append(_("HG: no files changed")) |
|
2199 | 2216 | edittext.append("") |
|
2200 | # run editor in the repository root | |
|
2201 | olddir = os.getcwd() | |
|
2202 | os.chdir(repo.root) | |
|
2203 | text = repo.ui.edit("\n".join(edittext), ctx.user(), ctx.extra()) | |
|
2204 | text = re.sub("(?m)^HG:.*(\n|$)", "", text) | |
|
2205 | os.chdir(olddir) | |
|
2206 | 2217 | |
|
2207 | if finishdesc: | |
|
2208 | text = finishdesc(text) | |
|
2209 | if not text.strip(): | |
|
2210 | raise util.Abort(_("empty commit message")) | |
|
2211 | ||
|
2212 | return text | |
|
2218 | return "\n".join(edittext) | |
|
2213 | 2219 | |
|
2214 | 2220 | def commitstatus(repo, node, branch, bheads=None, opts={}): |
|
2215 | 2221 | ctx = repo[node] |
General Comments 0
You need to be logged in to leave comments.
Login now