comparison contrib/bdiff-torture.py @ 43009:e05c141511dd

contrib: use pycompat.xrange in bdiff-torture.py For Python 3 compatibility. Differential Revision: https://phab.mercurial-scm.org/D6920
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 29 Sep 2019 12:25:29 -0700
parents 3316e59b0105
children 2372284d9457
comparison
equal deleted inserted replaced
43008:5f8b6617e962 43009:e05c141511dd
4 import random 4 import random
5 import sys 5 import sys
6 6
7 from mercurial import ( 7 from mercurial import (
8 mdiff, 8 mdiff,
9 pycompat,
9 ) 10 )
10 11
11 def reducetest(a, b): 12 def reducetest(a, b):
12 tries = 0 13 tries = 0
13 reductions = 0 14 reductions = 0
61 testwrap(b, a) 62 testwrap(b, a)
62 63
63 def rndtest(size, noise): 64 def rndtest(size, noise):
64 a = [] 65 a = []
65 src = " aaaaaaaabbbbccd" 66 src = " aaaaaaaabbbbccd"
66 for x in xrange(size): 67 for x in pycompat.xrange(size):
67 a.append(src[random.randint(0, len(src) - 1)]) 68 a.append(src[random.randint(0, len(src) - 1)])
68 69
69 while True: 70 while True:
70 b = [c for c in a if random.randint(0, 99) > noise] 71 b = [c for c in a if random.randint(0, 99) > noise]
71 b2 = [] 72 b2 = []