--- a/mercurial/hg.py Wed Jun 22 11:27:50 2005 -0800
+++ b/mercurial/hg.py Wed Jun 22 11:30:14 2005 -0800
@@ -10,7 +10,7 @@
from revlog import *
from demandload import *
demandload(globals(), "re lock urllib urllib2 transaction time socket")
-demandload(globals(), "tempfile httprangereader difflib")
+demandload(globals(), "tempfile httprangereader bdiff")
def is_exec(f):
return (os.stat(f).st_mode & 0100 != 0)
@@ -66,16 +66,15 @@
return [(rev, l) for l in text.splitlines(1)]
def strip(annotation):
- return [e[1] for e in annotation]
+ return "".join([e[1] for e in annotation])
def pair(parent, child):
new = []
- sm = difflib.SequenceMatcher(None, strip(parent), strip(child))
- for o, m, n, s, t in sm.get_opcodes():
- if o == 'equal':
- new += parent[m:n]
- else:
- new += child[s:t]
+ lb = 0
+ for a1, a2, b1, b2 in bdiff.blocks(strip(parent), strip(child)):
+ new += child[lb:b1]
+ new += parent[a1:a2]
+ lb = b2
return new
# find all ancestors