Mercurial > hg
comparison mercurial/cmdutil.py @ 8707:0550dfe4fca1
commit: editor reads file lists from provided context
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 01 Jun 2009 14:51:47 -0500 |
parents | b6511055d37b |
children | b9e0ddb04c5c |
comparison
equal
deleted
inserted
replaced
8706:25e9c71b89de | 8707:0550dfe4fca1 |
---|---|
1229 try: | 1229 try: |
1230 return commitfunc(ui, repo, message, m, opts) | 1230 return commitfunc(ui, repo, message, m, opts) |
1231 except ValueError, inst: | 1231 except ValueError, inst: |
1232 raise util.Abort(str(inst)) | 1232 raise util.Abort(str(inst)) |
1233 | 1233 |
1234 def commiteditor(repo, ctx, added, updated, removed): | 1234 def commiteditor(repo, ctx): |
1235 if ctx.description(): | 1235 if ctx.description(): |
1236 return ctx.description() | 1236 return ctx.description() |
1237 return commitforceeditor(repo, ctx, added, updated, removed) | 1237 return commitforceeditor(repo, ctx) |
1238 | 1238 |
1239 def commitforceeditor(repo, ctx, added, updated, removed): | 1239 def commitforceeditor(repo, ctx): |
1240 edittext = [] | 1240 edittext = [] |
1241 modified, added, removed = ctx.modified(), ctx.added(), ctx.removed() | |
1241 if ctx.description(): | 1242 if ctx.description(): |
1242 edittext.append(ctx.description()) | 1243 edittext.append(ctx.description()) |
1243 edittext.append("") | 1244 edittext.append("") |
1244 edittext.append("") # Empty line between message and comments. | 1245 edittext.append("") # Empty line between message and comments. |
1245 edittext.append(_("HG: Enter commit message." | 1246 edittext.append(_("HG: Enter commit message." |
1251 edittext.append(_("HG: branch merge")) | 1252 edittext.append(_("HG: branch merge")) |
1252 if ctx.branch(): | 1253 if ctx.branch(): |
1253 edittext.append(_("HG: branch '%s'") | 1254 edittext.append(_("HG: branch '%s'") |
1254 % encoding.tolocal(ctx.branch())) | 1255 % encoding.tolocal(ctx.branch())) |
1255 edittext.extend([_("HG: added %s") % f for f in added]) | 1256 edittext.extend([_("HG: added %s") % f for f in added]) |
1256 edittext.extend([_("HG: changed %s") % f for f in updated]) | 1257 edittext.extend([_("HG: changed %s") % f for f in modified]) |
1257 edittext.extend([_("HG: removed %s") % f for f in removed]) | 1258 edittext.extend([_("HG: removed %s") % f for f in removed]) |
1258 if not added and not updated and not removed: | 1259 if not added and not modified and not removed: |
1259 edittext.append(_("HG: no files changed")) | 1260 edittext.append(_("HG: no files changed")) |
1260 edittext.append("") | 1261 edittext.append("") |
1261 # run editor in the repository root | 1262 # run editor in the repository root |
1262 olddir = os.getcwd() | 1263 olddir = os.getcwd() |
1263 os.chdir(repo.root) | 1264 os.chdir(repo.root) |