diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -717,6 +717,9 @@ def revpair(repo, revs): if first is None: raise error.Abort(_('empty revision range')) + if (first == second and len(revs) >= 2 + and not all(revrange(repo, [r]) for r in revs)): + raise error.Abort(_('empty revision on one side of range')) # if top-level is range expression, the result must always be a pair if first == second and len(revs) == 1 and not _pairspec(revs[0]): diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t --- a/tests/test-extdiff.t +++ b/tests/test-extdiff.t @@ -70,6 +70,12 @@ Should diff cloned files directly: [1] #endif +Specifying an empty revision should abort. + + $ hg extdiff --patch --rev 'ancestor()' --rev 1 + abort: empty revision on one side of range + [255] + Test diff during merge: $ hg update -C 0