mercurial/commands.py
changeset 5224 9cd6578750b9
parent 5203 ce4e67533723
child 5241 5517aa5aafb0
equal deleted inserted replaced
5220:2b8373bda032 5224:9cd6578750b9
  1926         heads = repo.heads()
  1926         heads = repo.heads()
  1927         if len(heads) > 2:
  1927         if len(heads) > 2:
  1928             raise util.Abort(_('repo has %d heads - '
  1928             raise util.Abort(_('repo has %d heads - '
  1929                                'please merge with an explicit rev') %
  1929                                'please merge with an explicit rev') %
  1930                              len(heads))
  1930                              len(heads))
       
  1931         parent = repo.dirstate.parents()[0]
  1931         if len(heads) == 1:
  1932         if len(heads) == 1:
  1932             raise util.Abort(_('there is nothing to merge - '
  1933             msg = _('there is nothing to merge')
  1933                                'use "hg update" instead'))
  1934             if parent != repo.lookup(repo.workingctx().branch()):
  1934         parent = repo.dirstate.parents()[0]
  1935                 msg = _('%s - use "hg update" instead' % msg)
       
  1936             raise util.Abort(msg)
       
  1937 
  1935         if parent not in heads:
  1938         if parent not in heads:
  1936             raise util.Abort(_('working dir not at a head rev - '
  1939             raise util.Abort(_('working dir not at a head rev - '
  1937                                'use "hg update" or merge with an explicit rev'))
  1940                                'use "hg update" or merge with an explicit rev'))
  1938         node = parent == heads[0] and heads[-1] or heads[0]
  1941         node = parent == heads[0] and heads[-1] or heads[0]
  1939     return hg.merge(repo, node, force=force)
  1942     return hg.merge(repo, node, force=force)