Mercurial > hg
changeset 1452:f1755621cb7d
Remove now unused sortdiff and diff from mdiff
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 25 Oct 2005 22:17:31 -0700 |
parents | 54e4b187f69c |
children | 6fbb13b7a59f |
files | mercurial/mdiff.py |
diffstat | 1 files changed, 0 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/mdiff.py Tue Oct 25 22:15:44 2005 -0700 +++ b/mercurial/mdiff.py Tue Oct 25 22:17:31 2005 -0700 @@ -45,65 +45,6 @@ return "".join(l) -def sortdiff(a, b): - la = lb = 0 - lena = len(a) - lenb = len(b) - - while 1: - am, bm, = la, lb - - # walk over matching lines - while lb < lenb and la < lena and a[la] == b[lb] : - la += 1 - lb += 1 - - if la > am: - yield (am, bm, la - am) # return a match - - # skip mismatched lines from b - while la < lena and lb < lenb and b[lb] < a[la]: - lb += 1 - - if lb >= lenb: - break - - # skip mismatched lines from a - while la < lena and lb < lenb and b[lb] > a[la]: - la += 1 - - if la >= lena: - break - - yield (lena, lenb, 0) - -def diff(a, b, sorted=0): - if not a: - s = "".join(b) - return s and (struct.pack(">lll", 0, 0, len(s)) + s) - - bin = [] - p = [0] - for i in a: p.append(p[-1] + len(i)) - - if sorted: - try: - d = sortdiff(a, b) - except: - raise - else: - d = difflib.SequenceMatcher(None, a, b).get_matching_blocks() - la = 0 - lb = 0 - for am, bm, size in d: - s = "".join(b[lb:bm]) - if am > la or s: - bin.append(struct.pack(">lll", p[la], p[am], len(s)) + s) - la = am + size - lb = bm + size - - return "".join(bin) - def patchtext(bin): pos = 0 t = [] @@ -119,5 +60,3 @@ patches = mpatch.patches textdiff = bdiff.bdiff - -