Mercurial > hg-stable
changeset 16470:b2e1da5db6df stable
commands: add missing wlock to backout
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Thu, 19 Apr 2012 17:59:23 +0300 |
parents | dd68c972d089 |
children | 85c7602e283a |
files | mercurial/commands.py |
diffstat | 1 files changed, 40 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Apr 19 20:54:56 2012 +0900 +++ b/mercurial/commands.py Thu Apr 19 17:59:23 2012 +0300 @@ -449,42 +449,46 @@ parent = p1 # the backout should appear on the same branch - branch = repo.dirstate.branch() - hg.clean(repo, node, show_stats=False) - repo.dirstate.setbranch(branch) - revert_opts = opts.copy() - revert_opts['date'] = None - revert_opts['all'] = True - revert_opts['rev'] = hex(parent) - revert_opts['no_backup'] = None - revert(ui, repo, **revert_opts) - if not opts.get('merge') and op1 != node: - try: - ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) - return hg.update(repo, op1) - finally: - ui.setconfig('ui', 'forcemerge', '') - - commit_opts = opts.copy() - commit_opts['addremove'] = False - if not commit_opts['message'] and not commit_opts['logfile']: - # we don't translate commit messages - commit_opts['message'] = "Backed out changeset %s" % short(node) - commit_opts['force_editor'] = True - commit(ui, repo, **commit_opts) - def nice(node): - return '%d:%s' % (repo.changelog.rev(node), short(node)) - ui.status(_('changeset %s backs out changeset %s\n') % - (nice(repo.changelog.tip()), nice(node))) - if opts.get('merge') and op1 != node: - hg.clean(repo, op1, show_stats=False) - ui.status(_('merging with changeset %s\n') - % nice(repo.changelog.tip())) - try: - ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) - return hg.merge(repo, hex(repo.changelog.tip())) - finally: - ui.setconfig('ui', 'forcemerge', '') + wlock = repo.wlock() + try: + branch = repo.dirstate.branch() + hg.clean(repo, node, show_stats=False) + repo.dirstate.setbranch(branch) + revert_opts = opts.copy() + revert_opts['date'] = None + revert_opts['all'] = True + revert_opts['rev'] = hex(parent) + revert_opts['no_backup'] = None + revert(ui, repo, **revert_opts) + if not opts.get('merge') and op1 != node: + try: + ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + return hg.update(repo, op1) + finally: + ui.setconfig('ui', 'forcemerge', '') + + commit_opts = opts.copy() + commit_opts['addremove'] = False + if not commit_opts['message'] and not commit_opts['logfile']: + # we don't translate commit messages + commit_opts['message'] = "Backed out changeset %s" % short(node) + commit_opts['force_editor'] = True + commit(ui, repo, **commit_opts) + def nice(node): + return '%d:%s' % (repo.changelog.rev(node), short(node)) + ui.status(_('changeset %s backs out changeset %s\n') % + (nice(repo.changelog.tip()), nice(node))) + if opts.get('merge') and op1 != node: + hg.clean(repo, op1, show_stats=False) + ui.status(_('merging with changeset %s\n') + % nice(repo.changelog.tip())) + try: + ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + return hg.merge(repo, hex(repo.changelog.tip())) + finally: + ui.setconfig('ui', 'forcemerge', '') + finally: + wlock.release() return 0 @command('bisect',