mercurial/merge.py
changeset 34302 440ece43024c
parent 34142 24bf823377fc
child 34348 1a5abc45e2fa
equal deleted inserted replaced
34301:3704d3f21136 34302:440ece43024c
  1477         else:
  1477         else:
  1478             repo.dirstate.normal(f)
  1478             repo.dirstate.normal(f)
  1479 
  1479 
  1480 def update(repo, node, branchmerge, force, ancestor=None,
  1480 def update(repo, node, branchmerge, force, ancestor=None,
  1481            mergeancestor=False, labels=None, matcher=None, mergeforce=False,
  1481            mergeancestor=False, labels=None, matcher=None, mergeforce=False,
  1482            updatecheck=None):
  1482            updatecheck=None, wc=None):
  1483     """
  1483     """
  1484     Perform a merge between the working directory and the given node
  1484     Perform a merge between the working directory and the given node
  1485 
  1485 
  1486     node = the node to update to
  1486     node = the node to update to
  1487     branchmerge = whether to merge between branches
  1487     branchmerge = whether to merge between branches
  1524     x = can't happen
  1524     x = can't happen
  1525     * = don't-care
  1525     * = don't-care
  1526     1 = incompatible options (checked in commands.py)
  1526     1 = incompatible options (checked in commands.py)
  1527     2 = abort: uncommitted changes (commit or update --clean to discard changes)
  1527     2 = abort: uncommitted changes (commit or update --clean to discard changes)
  1528     3 = abort: uncommitted changes (checked in commands.py)
  1528     3 = abort: uncommitted changes (checked in commands.py)
       
  1529 
       
  1530     The merge is performed inside ``wc``, a workingctx-like objects. It defaults
       
  1531     to repo[None] if None is passed.
  1529 
  1532 
  1530     Return the same tuple as applyupdates().
  1533     Return the same tuple as applyupdates().
  1531     """
  1534     """
  1532     # Avoid cycle.
  1535     # Avoid cycle.
  1533     from . import sparse
  1536     from . import sparse
  1548     if matcher is None or matcher.always():
  1551     if matcher is None or matcher.always():
  1549         partial = False
  1552         partial = False
  1550     else:
  1553     else:
  1551         partial = True
  1554         partial = True
  1552     with repo.wlock():
  1555     with repo.wlock():
  1553         wc = repo[None]
  1556         if wc is None:
       
  1557             wc = repo[None]
  1554         pl = wc.parents()
  1558         pl = wc.parents()
  1555         p1 = pl[0]
  1559         p1 = pl[0]
  1556         pas = [None]
  1560         pas = [None]
  1557         if ancestor is not None:
  1561         if ancestor is not None:
  1558             pas = [repo[ancestor]]
  1562             pas = [repo[ancestor]]