Mercurial > hg-stable
diff mercurial/commands.py @ 18689:12721a20ed30
backout: call cmdutil.commit directly instead of commands.commit
This cleans up the messiness of having one command call another, and
makes the backout command robust against changes to the commit command.
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Tue, 12 Feb 2013 16:36:44 +0000 |
parents | 79107fad06aa |
children | 5bef0655f2e9 |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Feb 12 16:32:14 2013 +0000 +++ b/mercurial/commands.py Tue Feb 12 16:36:44 2013 +0000 @@ -456,6 +456,7 @@ wlock = repo.wlock() try: branch = repo.dirstate.branch() + bheads = repo.branchheads(branch) hg.clean(repo, node, show_stats=False) repo.dirstate.setbranch(branch) rctx = scmutil.revsingle(repo, hex(parent)) @@ -467,11 +468,17 @@ finally: ui.setconfig('ui', 'forcemerge', '') + e = cmdutil.commiteditor if not opts['message'] and not opts['logfile']: # we don't translate commit messages opts['message'] = "Backed out changeset %s" % short(node) - opts['force_editor'] = True - commit(ui, repo, **opts) + e = cmdutil.commitforceeditor + + def commitfunc(ui, repo, message, match, opts): + return repo.commit(message, opts.get('user'), opts.get('date'), + match, editor=e) + newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) + cmdutil.commitstatus(repo, newnode, branch, bheads) def nice(node): return '%d:%s' % (repo.changelog.rev(node), short(node))