Mercurial > hg-stable
diff mercurial/cmdutil.py @ 17473:9732473aa24b
amend: use an explicit commit message for temporary amending commit
Before this changeset, the extra commit created during amend had
the same description as the final commit. This was a bit confusing
when trying to understand what that extra commit was about.
This changeset changes the description of such commit to:
temporary amend commit for <ammend-commit-hash>
The old behaviour was not a big deal, but would become more confusing
once we use obsolescence marker instead of stripping the precursors.
This also helps if the user restores a strip backup.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Sat, 25 Aug 2012 16:20:41 +0200 |
parents | 965fbe04fd96 |
children | 63e45aee46d4 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Mon Sep 10 23:44:24 2012 +0200 +++ b/mercurial/cmdutil.py Sat Aug 25 16:20:41 2012 +0200 @@ -1582,10 +1582,14 @@ lock = repo.lock() tr = repo.transaction('amend') try: + # See if we got a message from -m or -l, if not, open the editor + # with the message of the changeset to amend + message = logmessage(ui, opts) # First, do a regular commit to record all changes in the working # directory (if there are any) ui.callhooks = False try: + opts['message'] = 'temporary amend commit for %s' % old node = commit(ui, repo, commitfunc, pats, opts) finally: ui.callhooks = True @@ -1618,7 +1622,6 @@ user = ctx.user() date = ctx.date() - message = ctx.description() # Recompute copies (avoid recording a -> b -> a) copied = copies.pathcopies(base, ctx) @@ -1663,17 +1666,10 @@ except KeyError: raise IOError - # See if we got a message from -m or -l, if not, open the editor - # with the message of the changeset to amend user = opts.get('user') or old.user() date = opts.get('date') or old.date() - message = logmessage(ui, opts) - if not message: - cctx = context.workingctx(repo, old.description(), - user, date, extra, - repo.status(base.node(), - old.node())) - message = commitforceeditor(repo, cctx, []) + if not message: + message = old.description() new = context.memctx(repo, parents=[base.node(), nullid], @@ -1683,6 +1679,7 @@ user=user, date=date, extra=extra) + new._text = commitforceeditor(repo, new, []) ph = repo.ui.config('phases', 'new-commit', phases.draft) try: repo.ui.setconfig('phases', 'new-commit', old.phase())