equal
deleted
inserted
replaced
3 # Copyright 2005 Matt Mackall <mpm@selenic.com> |
3 # Copyright 2005 Matt Mackall <mpm@selenic.com> |
4 # |
4 # |
5 # This software may be used and distributed according to the terms |
5 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. |
6 # of the GNU General Public License, incorporated herein by reference. |
7 |
7 |
8 import difflib, struct |
8 import difflib, struct, bdiff |
9 from mercurial.mpatch import * |
9 from mpatch import * |
10 |
10 |
11 def unidiff(a, ad, b, bd, fn, r=None): |
11 def unidiff(a, ad, b, bd, fn, r=None): |
12 |
12 |
13 if not a and not b: return "" |
13 if not a and not b: return "" |
14 |
14 |
40 if r: |
40 if r: |
41 l.insert(0, "diff %s %s\n" % |
41 l.insert(0, "diff %s %s\n" % |
42 (' '.join(["-r %s" % rev for rev in r]), fn)) |
42 (' '.join(["-r %s" % rev for rev in r]), fn)) |
43 |
43 |
44 return "".join(l) |
44 return "".join(l) |
45 |
|
46 def textdiff(a, b): |
|
47 return diff(a.splitlines(1), b.splitlines(1)) |
|
48 |
45 |
49 def sortdiff(a, b): |
46 def sortdiff(a, b): |
50 la = lb = 0 |
47 la = lb = 0 |
51 lena = len(a) |
48 lena = len(a) |
52 lenb = len(b) |
49 lenb = len(b) |
116 pos += l |
113 pos += l |
117 return "".join(t) |
114 return "".join(t) |
118 |
115 |
119 def patch(a, bin): |
116 def patch(a, bin): |
120 return patches(a, [bin]) |
117 return patches(a, [bin]) |
|
118 |
|
119 textdiff = bdiff.bdiff |
|
120 |
|
121 |