diff --git a/mercurial/diffhelpers.py b/mercurial/diffhelpers.py --- a/mercurial/diffhelpers.py +++ b/mercurial/diffhelpers.py @@ -69,7 +69,7 @@ def testhunk(a, b, bstart): """ alen = len(a) blen = len(b) - if alen > blen - bstart: + if alen > blen - bstart or bstart < 0: return False for i in xrange(alen): if a[i][1:] != b[i + bstart]: