##// END OF EJS Templates
Replace difflib with bdiff for annotate...
mpm@selenic.com -
r434:08f00b64 default
parent child Browse files
Show More
@@ -10,7 +10,7 b' import util'
10 10 from revlog import *
11 11 from demandload import *
12 12 demandload(globals(), "re lock urllib urllib2 transaction time socket")
13 demandload(globals(), "tempfile httprangereader difflib")
13 demandload(globals(), "tempfile httprangereader bdiff")
14 14
15 15 def is_exec(f):
16 16 return (os.stat(f).st_mode & 0100 != 0)
@@ -66,16 +66,15 b' class filelog(revlog):'
66 66 return [(rev, l) for l in text.splitlines(1)]
67 67
68 68 def strip(annotation):
69 return [e[1] for e in annotation]
69 return "".join([e[1] for e in annotation])
70 70
71 71 def pair(parent, child):
72 72 new = []
73 sm = difflib.SequenceMatcher(None, strip(parent), strip(child))
74 for o, m, n, s, t in sm.get_opcodes():
75 if o == 'equal':
76 new += parent[m:n]
77 else:
78 new += child[s:t]
73 lb = 0
74 for a1, a2, b1, b2 in bdiff.blocks(strip(parent), strip(child)):
75 new += child[lb:b1]
76 new += parent[a1:a2]
77 lb = b2
79 78 return new
80 79
81 80 # find all ancestors
General Comments 0
You need to be logged in to leave comments. Login now