Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 6723:1fe6f365df2e
merge: only in-branch merges can be implicit
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 23 Jun 2008 15:02:52 +0200 |
parents | bb1575f74f27 |
children | c9fbd6ec3489 |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Jun 23 15:03:22 2008 +0200 +++ b/mercurial/commands.py Mon Jun 23 15:02:52 2008 +0200 @@ -1891,7 +1891,7 @@ performed before any further updates are allowed. If no revision is specified, the working directory's parent is a - head revision, and the repository contains exactly one other head, + head revision, and the current branch contains exactly one other head, the other head is merged with by default. Otherwise, an explicit revision to merge with must be provided. """ @@ -1902,22 +1902,28 @@ node = rev if not node: - heads = repo.heads() - if len(heads) > 2: - raise util.Abort(_('repo has %d heads - ' - 'please merge with an explicit rev') % - len(heads)) + branch = repo.workingctx().branch() + bheads = repo.branchheads() + if len(bheads) > 2: + raise util.Abort(_("branch '%s' has %d heads - " + "please merge with an explicit rev") % + (branch, len(bheads))) + parent = repo.dirstate.parents()[0] - if len(heads) == 1: + if len(bheads) == 1: + if len(repo.heads()) > 1: + raise util.Abort(_("branch '%s' has one head - " + "please merge with an explicit rev") % + branch) msg = _('there is nothing to merge') if parent != repo.lookup(repo.workingctx().branch()): msg = _('%s - use "hg update" instead') % msg raise util.Abort(msg) - if parent not in heads: + if parent not in bheads: raise util.Abort(_('working dir not at a head rev - ' 'use "hg update" or merge with an explicit rev')) - node = parent == heads[0] and heads[-1] or heads[0] + node = parent == bheads[0] and bheads[-1] or bheads[0] return hg.merge(repo, node, force=force) def outgoing(ui, repo, dest=None, **opts):