mercurial/merge.py
changeset 16696 d1afbf03e69a
parent 16683 525fdb738975
child 16719 e7bf09acd410
equal deleted inserted replaced
16695:0a0933d3d59c 16696:d1afbf03e69a
   478             else:
   478             else:
   479                 repo.dirstate.normal(fd)
   479                 repo.dirstate.normal(fd)
   480                 if f:
   480                 if f:
   481                     repo.dirstate.drop(f)
   481                     repo.dirstate.drop(f)
   482 
   482 
   483 def update(repo, node, branchmerge, force, partial, ancestor=None):
   483 def update(repo, node, branchmerge, force, partial, ancestor=None,
       
   484            mergeancestor=False):
   484     """
   485     """
   485     Perform a merge between the working directory and the given node
   486     Perform a merge between the working directory and the given node
   486 
   487 
   487     node = the node to update to, or None if unspecified
   488     node = the node to update to, or None if unspecified
   488     branchmerge = whether to merge between branches
   489     branchmerge = whether to merge between branches
   489     force = whether to force branch merging or file overwriting
   490     force = whether to force branch merging or file overwriting
   490     partial = a function to filter file lists (dirstate not updated)
   491     partial = a function to filter file lists (dirstate not updated)
       
   492     mergeancestor = if false, merging with an ancestor (fast-forward)
       
   493       is only allowed between different named branches. This flag
       
   494       is used by rebase extension as a temporary fix and should be
       
   495       avoided in general.
   491 
   496 
   492     The table below shows all the behaviors of the update command
   497     The table below shows all the behaviors of the update command
   493     given the -c and -C or no options, whether the working directory
   498     given the -c and -C or no options, whether the working directory
   494     is dirty, whether a revision is specified, and the relationship of
   499     is dirty, whether a revision is specified, and the relationship of
   495     the parent rev to the target rev (linear, on the same named
   500     the parent rev to the target rev (linear, on the same named
   546         if branchmerge:
   551         if branchmerge:
   547             if pa == p2:
   552             if pa == p2:
   548                 raise util.Abort(_("merging with a working directory ancestor"
   553                 raise util.Abort(_("merging with a working directory ancestor"
   549                                    " has no effect"))
   554                                    " has no effect"))
   550             elif pa == p1:
   555             elif pa == p1:
   551                 if p1.branch() == p2.branch():
   556                 if not mergeancestor and p1.branch() == p2.branch():
   552                     raise util.Abort(_("nothing to merge"),
   557                     raise util.Abort(_("nothing to merge"),
   553                                      hint=_("use 'hg update' "
   558                                      hint=_("use 'hg update' "
   554                                             "or check 'hg heads'"))
   559                                             "or check 'hg heads'"))
   555             if not force and (wc.files() or wc.deleted()):
   560             if not force and (wc.files() or wc.deleted()):
   556                 raise util.Abort(_("outstanding uncommitted changes"),
   561                 raise util.Abort(_("outstanding uncommitted changes"),