Mercurial > hg
comparison mercurial/merge.py @ 13874:9d67277c9204
merge: add ancestor to the update function
This makes it easier to do rebase-like operations.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 04 Apr 2011 15:25:20 -0500 |
parents | 15d1db2abfcb |
children | a8d13ee0ce68 |
comparison
equal
deleted
inserted
replaced
13873:02c3d4d44a92 | 13874:9d67277c9204 |
---|---|
437 else: | 437 else: |
438 repo.dirstate.normal(fd) | 438 repo.dirstate.normal(fd) |
439 if f: | 439 if f: |
440 repo.dirstate.forget(f) | 440 repo.dirstate.forget(f) |
441 | 441 |
442 def update(repo, node, branchmerge, force, partial): | 442 def update(repo, node, branchmerge, force, partial, ancestor=None): |
443 """ | 443 """ |
444 Perform a merge between the working directory and the given node | 444 Perform a merge between the working directory and the given node |
445 | 445 |
446 node = the node to update to, or None if unspecified | 446 node = the node to update to, or None if unspecified |
447 branchmerge = whether to merge between branches | 447 branchmerge = whether to merge between branches |
490 else: | 490 else: |
491 raise util.Abort(_("branch %s not found") % wc.branch()) | 491 raise util.Abort(_("branch %s not found") % wc.branch()) |
492 overwrite = force and not branchmerge | 492 overwrite = force and not branchmerge |
493 pl = wc.parents() | 493 pl = wc.parents() |
494 p1, p2 = pl[0], repo[node] | 494 p1, p2 = pl[0], repo[node] |
495 pa = p1.ancestor(p2) | 495 if ancestor: |
496 pa = repo[ancestor] | |
497 else: | |
498 pa = p1.ancestor(p2) | |
499 | |
496 fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2) | 500 fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2) |
497 | 501 |
498 ### check phase | 502 ### check phase |
499 if not overwrite and len(pl) > 1: | 503 if not overwrite and len(pl) > 1: |
500 raise util.Abort(_("outstanding uncommitted merges")) | 504 raise util.Abort(_("outstanding uncommitted merges")) |