# HG changeset patch # User Matt Mackall # Date 1130303851 25200 # Node ID f1755621cb7dbbfd9fc68a30e0963e392bf462d9 # Parent 54e4b187f69c96a3ddea4f1c84bd6b6d8ca904b9 Remove now unused sortdiff and diff from mdiff diff -r 54e4b187f69c -r f1755621cb7d mercurial/mdiff.py --- 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 - -