Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/diffhelpers.py @ 37802:090c89a8db32 stable
diffhelpers: backport 9e40bc4c1bde from C implementation
9e40bc4c1bde just says "harden testhunk." I don't think this would be
the case, but it makes some sense to avoid negative index.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 19 Apr 2018 23:33:17 +0900 |
parents | 230eb9594150 |
children |
comparison
equal
deleted
inserted
replaced
37801:5cab6f5016fa | 37802:090c89a8db32 |
---|---|
67 a is assumed to have a control char at the start of each line, this char | 67 a is assumed to have a control char at the start of each line, this char |
68 is ignored in the compare. | 68 is ignored in the compare. |
69 """ | 69 """ |
70 alen = len(a) | 70 alen = len(a) |
71 blen = len(b) | 71 blen = len(b) |
72 if alen > blen - bstart: | 72 if alen > blen - bstart or bstart < 0: |
73 return False | 73 return False |
74 for i in xrange(alen): | 74 for i in xrange(alen): |
75 if a[i][1:] != b[i + bstart]: | 75 if a[i][1:] != b[i + bstart]: |
76 return False | 76 return False |
77 return True | 77 return True |