comparison mercurial/mdiff.py @ 432:3b9e3d3d2810

Start using bdiff for generating deltas -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Start using bdiff for generating deltas manifest hash: bf6ed7d17d96810b7f40b50811b104b568c64b4b -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCubqVywK+sNU5EO8RAor6AKCm8Zqg0DIhLzaMPp5/GKPKk/GjKwCfbCe+ /CBmpvcTxSJofY9RE08cCVY= =2yu2 -----END PGP SIGNATURE-----
author mpm@selenic.com
date Wed, 22 Jun 2005 11:23:01 -0800
parents 8f8bb77d560e
children 03f27b1381f9
comparison
equal deleted inserted replaced
431:dfc44f3f587c 432:3b9e3d3d2810
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