456 wlock = repo.wlock() |
456 wlock = repo.wlock() |
457 try: |
457 try: |
458 branch = repo.dirstate.branch() |
458 branch = repo.dirstate.branch() |
459 hg.clean(repo, node, show_stats=False) |
459 hg.clean(repo, node, show_stats=False) |
460 repo.dirstate.setbranch(branch) |
460 repo.dirstate.setbranch(branch) |
461 revert_opts = opts.copy() |
461 rctx = scmutil.revsingle(repo, hex(parent)) |
462 revert_opts['date'] = None |
462 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) |
463 revert_opts['all'] = True |
|
464 revert_opts['rev'] = hex(parent) |
|
465 revert_opts['no_backup'] = None |
|
466 revert(ui, repo, **revert_opts) |
|
467 if not opts.get('merge') and op1 != node: |
463 if not opts.get('merge') and op1 != node: |
468 try: |
464 try: |
469 ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) |
465 ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) |
470 return hg.update(repo, op1) |
466 return hg.update(repo, op1) |
471 finally: |
467 finally: |