Mercurial > hg-stable
comparison mercurial/commands.py @ 20275:2123d27ff75d
backout: avoid update on simple case.
Before the changeset the backout process was:
1) go to <target>
2) revert to <target> parent
3) update back to changeset we came from
The two update steps can takes a very long time to move back and forth unrelated
file change between <target> and current working directory.
The new process is just merging current working directory with the parent of
<target> using <target> as ancestor. This give the very same result but skip
the two updates. On big repo with a lot of files and changes that save a lots of
time (x20 for one week window).
The "merge" version (hg backout --merge) is still done with upgrades. We could
imagine using in memory commit to speed it up but this is another fish.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 08 Jan 2014 14:53:46 -0800 |
parents | 0d32dd60016c |
children | 6545770bd379 |
comparison
equal
deleted
inserted
replaced
20274:7a259dfe24f7 | 20275:2123d27ff75d |
---|---|
459 # the backout should appear on the same branch | 459 # the backout should appear on the same branch |
460 wlock = repo.wlock() | 460 wlock = repo.wlock() |
461 try: | 461 try: |
462 branch = repo.dirstate.branch() | 462 branch = repo.dirstate.branch() |
463 bheads = repo.branchheads(branch) | 463 bheads = repo.branchheads(branch) |
464 hg.clean(repo, node, show_stats=False) | |
465 repo.dirstate.setbranch(branch) | |
466 rctx = scmutil.revsingle(repo, hex(parent)) | 464 rctx = scmutil.revsingle(repo, hex(parent)) |
467 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) | |
468 if not opts.get('merge') and op1 != node: | 465 if not opts.get('merge') and op1 != node: |
469 try: | 466 try: |
470 ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) | 467 ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) |
471 return hg.update(repo, op1) | 468 stats = mergemod.update(repo, parent, True, True, False, node, False) |
469 repo.setparents(op1, op2) | |
470 hg._showstats(repo, stats) | |
471 if stats[3]: | |
472 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) | |
473 return stats[3] > 0 | |
472 finally: | 474 finally: |
473 ui.setconfig('ui', 'forcemerge', '') | 475 ui.setconfig('ui', 'forcemerge', '') |
476 else: | |
477 hg.clean(repo, node, show_stats=False) | |
478 repo.dirstate.setbranch(branch) | |
479 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) | |
480 | |
474 | 481 |
475 e = cmdutil.commiteditor | 482 e = cmdutil.commiteditor |
476 if not opts['message'] and not opts['logfile']: | 483 if not opts['message'] and not opts['logfile']: |
477 # we don't translate commit messages | 484 # we don't translate commit messages |
478 opts['message'] = "Backed out changeset %s" % short(node) | 485 opts['message'] = "Backed out changeset %s" % short(node) |