##// 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 from revlog import *
10 from revlog import *
11 from demandload import *
11 from demandload import *
12 demandload(globals(), "re lock urllib urllib2 transaction time socket")
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 def is_exec(f):
15 def is_exec(f):
16 return (os.stat(f).st_mode & 0100 != 0)
16 return (os.stat(f).st_mode & 0100 != 0)
@@ -66,16 +66,15 b' class filelog(revlog):'
66 return [(rev, l) for l in text.splitlines(1)]
66 return [(rev, l) for l in text.splitlines(1)]
67
67
68 def strip(annotation):
68 def strip(annotation):
69 return [e[1] for e in annotation]
69 return "".join([e[1] for e in annotation])
70
70
71 def pair(parent, child):
71 def pair(parent, child):
72 new = []
72 new = []
73 sm = difflib.SequenceMatcher(None, strip(parent), strip(child))
73 lb = 0
74 for o, m, n, s, t in sm.get_opcodes():
74 for a1, a2, b1, b2 in bdiff.blocks(strip(parent), strip(child)):
75 if o == 'equal':
75 new += child[lb:b1]
76 new += parent[m:n]
76 new += parent[a1:a2]
77 else:
77 lb = b2
78 new += child[s:t]
79 return new
78 return new
80
79
81 # find all ancestors
80 # find all ancestors
General Comments 0
You need to be logged in to leave comments. Login now