comparison mercurial/commands.py @ 21412:6f6ccb0bb6af

backout: avoid redundant message examination Before this patch, "hg backout" examines "--message" and "--logfile" options explicitly. But this examination is redundant, because "commitfunc()" can receive the result of same examination by "cmdutil.logmessage()" in "cmdutil.commit()" through "message" argument. This patch avoids redundant message examination by "message" examination in "commitfunc()".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 11 May 2014 00:49:35 +0900
parents ca275f7ec576
children edc55317de90
comparison
equal deleted inserted replaced
21411:afff78be4361 21412:6f6ccb0bb6af
485 hg.clean(repo, node, show_stats=False) 485 hg.clean(repo, node, show_stats=False)
486 repo.dirstate.setbranch(branch) 486 repo.dirstate.setbranch(branch)
487 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) 487 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents())
488 488
489 489
490 e = cmdutil.commiteditor
491 if not opts['message'] and not opts['logfile']:
492 # we don't translate commit messages
493 opts['message'] = "Backed out changeset %s" % short(node)
494 e = cmdutil.commitforceeditor
495
496 def commitfunc(ui, repo, message, match, opts): 490 def commitfunc(ui, repo, message, match, opts):
491 e = cmdutil.commiteditor
492 if not message:
493 # we don't translate commit messages
494 message = "Backed out changeset %s" % short(node)
495 e = cmdutil.commitforceeditor
497 return repo.commit(message, opts.get('user'), opts.get('date'), 496 return repo.commit(message, opts.get('user'), opts.get('date'),
498 match, editor=e) 497 match, editor=e)
499 newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) 498 newnode = cmdutil.commit(ui, repo, commitfunc, [], opts)
500 if not newnode: 499 if not newnode:
501 ui.status(_("nothing changed\n")) 500 ui.status(_("nothing changed\n"))