diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -426,7 +426,12 @@ def findoutgoing(ui, repo, remote=None, outgoing = discovery.findcommonoutgoing(repo, other, revs, force=force) if not outgoing.missing: raise util.Abort(_('no outgoing ancestors')) - return outgoing.missing[0] + roots = list(repo.revs("roots(%ln)", outgoing.missing)) + if 1 < len(roots): + msg = _('there are ambiguous outgoing revisions') + hint = _('see "hg help histedit" for more detail') + raise util.Abort(msg, hint=hint) + return repo.lookup(roots[0]) actiontable = {'p': pick, 'pick': pick, diff --git a/tests/test-histedit-outgoing.t b/tests/test-histedit-outgoing.t --- a/tests/test-histedit-outgoing.t +++ b/tests/test-histedit-outgoing.t @@ -102,4 +102,38 @@ test sensitivity to branch in URL: # m, mess = edit message without changing commit content # 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + +test to check number of roots in outgoing revisions + + $ hg -q outgoing -G --template '{node|short}({branch})' '../r' + @ f26599ee3441(foo) + + o 652413bf663e(default) + | + o e860deea161a(default) + | + o 055a42cdd887(default) + + $ HGEDITOR=cat hg -q histedit --outgoing '../r' + abort: there are ambiguous outgoing revisions + (see "hg help histedit" for more detail) + [255] + + $ hg -q update -C 2 + $ echo aa >> a + $ hg -q commit -m 'another head on default' + $ hg -q outgoing -G --template '{node|short}({branch})' '../r#default' + @ 3879dc049647(default) + + o 652413bf663e(default) + | + o e860deea161a(default) + | + o 055a42cdd887(default) + + $ HGEDITOR=cat hg -q histedit --outgoing '../r#default' + abort: there are ambiguous outgoing revisions + (see "hg help histedit" for more detail) + [255] + $ cd ..