mercurial/commands.py
changeset 2903 013921c753bd
parent 2896 02e239bbd7f9
child 2907 b70740aefa4d
equal deleted inserted replaced
2902:cd7bbb19b96e 2903:013921c753bd
  1967 
  1967 
  1968     Merge the contents of the current working directory and the
  1968     Merge the contents of the current working directory and the
  1969     requested revision. Files that changed between either parent are
  1969     requested revision. Files that changed between either parent are
  1970     marked as changed for the next commit and a commit must be
  1970     marked as changed for the next commit and a commit must be
  1971     performed before any further updates are allowed.
  1971     performed before any further updates are allowed.
  1972     """
  1972 
  1973 
  1973     If no revision is specified, the working directory's parent is a
  1974     node = _lookup(repo, node, branch)
  1974     head revision, and the repository contains exactly one other head,
       
  1975     the other head is merged with by default.  Otherwise, an explicit
       
  1976     revision to merge with must be provided.
       
  1977     """
       
  1978 
       
  1979     if node:
       
  1980         node = _lookup(repo, node, branch)
       
  1981     else:
       
  1982         heads = repo.heads()
       
  1983         if len(heads) > 2:
       
  1984             raise util.Abort(_('repo has %d heads - '
       
  1985                                'please merge with an explicit rev') %
       
  1986                              len(heads))
       
  1987         if len(heads) == 1:
       
  1988             raise util.Abort(_('there is nothing to merge - '
       
  1989                                'use "hg update" instead'))
       
  1990         parent = repo.dirstate.parents()[0]
       
  1991         if parent not in heads:
       
  1992             raise util.Abort(_('working dir not at a head rev - '
       
  1993                                'use "hg update" or merge with an explicit rev'))
       
  1994         node = parent == heads[0] and heads[-1] or heads[0]
  1975     return hg.merge(repo, node, force=force)
  1995     return hg.merge(repo, node, force=force)
  1976 
  1996 
  1977 def outgoing(ui, repo, dest=None, **opts):
  1997 def outgoing(ui, repo, dest=None, **opts):
  1978     """show changesets not found in destination
  1998     """show changesets not found in destination
  1979 
  1999