diff options
author | Ori Bernstein <ori@eigenstate.org> | 2021-06-14 00:00:37 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2021-06-14 00:00:37 +0000 |
commit | a73a964e51247ed169d322c725a3a18859f109a3 (patch) | |
tree | 3f752d117274d444bda44e85609aeac1acf313f3 /sys/lib/python/mercurial/pure/diffhelpers.py | |
parent | e64efe273fcb921a61bf27d33b230c4e64fcd425 (diff) |
python, hg: tow outside the environment.
they've served us well, and can ride off into the sunset.
Diffstat (limited to 'sys/lib/python/mercurial/pure/diffhelpers.py')
-rw-r--r-- | sys/lib/python/mercurial/pure/diffhelpers.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/sys/lib/python/mercurial/pure/diffhelpers.py b/sys/lib/python/mercurial/pure/diffhelpers.py deleted file mode 100644 index e7f2e915e..000000000 --- a/sys/lib/python/mercurial/pure/diffhelpers.py +++ /dev/null @@ -1,56 +0,0 @@ -# diffhelpers.py - pure Python implementation of diffhelpers.c -# -# Copyright 2009 Matt Mackall <mpm@selenic.com> and others -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2, incorporated herein by reference. - -def addlines(fp, hunk, lena, lenb, a, b): - while True: - todoa = lena - len(a) - todob = lenb - len(b) - num = max(todoa, todob) - if num == 0: - break - for i in xrange(num): - s = fp.readline() - c = s[0] - if s == "\\ No newline at end of file\n": - fix_newline(hunk, a, b) - continue - if c == "\n": - # Some patches may be missing the control char - # on empty lines. Supply a leading space. - s = " \n" - hunk.append(s) - if c == "+": - b.append(s[1:]) - elif c == "-": - a.append(s) - else: - b.append(s[1:]) - a.append(s) - return 0 - -def fix_newline(hunk, a, b): - l = hunk[-1] - c = l[0] - hline = l[:-1] - - if c == " " or c == "+": - b[-1] = l[1:-1] - if c == " " or c == "-": - a[-1] = hline - hunk[-1] = hline - return 0 - - -def testhunk(a, b, bstart): - alen = len(a) - blen = len(b) - if alen > blen - bstart: - return -1 - for i in xrange(alen): - if a[i][1:] != b[i + bstart]: - return -1 - return 0 |