comparison contrib/bdiff-torture.py @ 32202:ded48ad55146

bdiff: proxy through mdiff module See the previous commit for why. mdiff seems a good place to host bdiff functions. bdiff.bdiff was already aliased as textdiff, so we use it.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 26 Apr 2017 22:03:37 +0900
parents eccfd6500636
children 0c73634d0570
comparison
equal deleted inserted replaced
32201:4462a981e8df 32202:ded48ad55146
3 from __future__ import absolute_import, print_function 3 from __future__ import absolute_import, print_function
4 import random 4 import random
5 import sys 5 import sys
6 6
7 from mercurial import ( 7 from mercurial import (
8 bdiff, 8 mdiff,
9 mpatch, 9 mpatch,
10 ) 10 )
11 11
12 def reducetest(a, b): 12 def reducetest(a, b):
13 tries = 0 13 tries = 0
40 print("failed:", inst) 40 print("failed:", inst)
41 41
42 sys.exit(0) 42 sys.exit(0)
43 43
44 def test1(a, b): 44 def test1(a, b):
45 d = bdiff.bdiff(a, b) 45 d = mdiff.textdiff(a, b)
46 if not d: 46 if not d:
47 raise ValueError("empty") 47 raise ValueError("empty")
48 c = mpatch.patches(a, [d]) 48 c = mpatch.patches(a, [d])
49 if c != b: 49 if c != b:
50 raise ValueError("bad") 50 raise ValueError("bad")