Show More
@@ -14,11 +14,6 b' from mercurial import (' | |||||
14 |
|
14 | |||
15 | from hgext import rebase |
|
15 | from hgext import rebase | |
16 |
|
16 | |||
17 | try: |
|
|||
18 | xrange |
|
|||
19 | except NameError: |
|
|||
20 | xrange = range |
|
|||
21 |
|
||||
22 | cmdtable = {} |
|
17 | cmdtable = {} | |
23 | command = registrar.command(cmdtable) |
|
18 | command = registrar.command(cmdtable) | |
24 |
|
19 | |||
@@ -41,7 +36,7 b' def debugbruterebase(ui, repo, source, d' | |||||
41 | result += b"'" |
|
36 | result += b"'" | |
42 | return result |
|
37 | return result | |
43 |
|
38 | |||
44 |
for i in |
|
39 | for i in range(1, 2 ** len(srevs)): | |
45 | subset = [rev for j, rev in enumerate(srevs) if i & (1 << j) != 0] |
|
40 | subset = [rev for j, rev in enumerate(srevs) if i & (1 << j) != 0] | |
46 | spec = revsetlang.formatspec(b'%ld', subset) |
|
41 | spec = revsetlang.formatspec(b'%ld', subset) | |
47 | tr = repo.transaction(b'rebase') |
|
42 | tr = repo.transaction(b'rebase') | |
@@ -58,7 +53,7 b' def debugbruterebase(ui, repo, source, d' | |||||
58 | # short summary about new nodes |
|
53 | # short summary about new nodes | |
59 | cl = repo.changelog |
|
54 | cl = repo.changelog | |
60 | descs = [] |
|
55 | descs = [] | |
61 |
for rev in |
|
56 | for rev in range(repolen, len(repo)): | |
62 | desc = b'%s:' % getdesc(rev) |
|
57 | desc = b'%s:' % getdesc(rev) | |
63 | for prev in cl.parentrevs(rev): |
|
58 | for prev in cl.parentrevs(rev): | |
64 | if prev > -1: |
|
59 | if prev > -1: |
@@ -26,7 +26,6 b" osenvironb = getattr(os, 'environb', os." | |||||
26 |
|
26 | |||
27 | if sys.version_info > (3, 5, 0): |
|
27 | if sys.version_info > (3, 5, 0): | |
28 | PYTHON3 = True |
|
28 | PYTHON3 = True | |
29 | xrange = range # we use xrange in one place, and we'd rather not use range |
|
|||
30 |
|
29 | |||
31 | def _sys2bytes(p): |
|
30 | def _sys2bytes(p): | |
32 | return p.encode('utf-8') |
|
31 | return p.encode('utf-8') |
@@ -151,9 +151,6 b' if pygmentspresent:' | |||||
151 | origenviron = os.environ.copy() |
|
151 | origenviron = os.environ.copy() | |
152 |
|
152 | |||
153 |
|
153 | |||
154 | xrange = range # we use xrange in one place, and we'd rather not use range |
|
|||
155 |
|
||||
156 |
|
||||
157 | def _sys2bytes(p): |
|
154 | def _sys2bytes(p): | |
158 | if p is None: |
|
155 | if p is None: | |
159 | return p |
|
156 | return p | |
@@ -1422,7 +1419,7 b' class Test(unittest.TestCase):' | |||||
1422 | env['HGTEST_TIMEOUT_DEFAULT'] = formated_timeout |
|
1419 | env['HGTEST_TIMEOUT_DEFAULT'] = formated_timeout | |
1423 | env['HGTEST_TIMEOUT'] = _bytes2sys(b"%d" % self._timeout) |
|
1420 | env['HGTEST_TIMEOUT'] = _bytes2sys(b"%d" % self._timeout) | |
1424 | # This number should match portneeded in _getport |
|
1421 | # This number should match portneeded in _getport | |
1425 |
for port in |
|
1422 | for port in range(3): | |
1426 | # This list should be parallel to _portmap in _getreplacements |
|
1423 | # This list should be parallel to _portmap in _getreplacements | |
1427 | defineport(port) |
|
1424 | defineport(port) | |
1428 | env["HGRCPATH"] = _bytes2sys(os.path.join(self._threadtmp, b'.hgrc')) |
|
1425 | env["HGRCPATH"] = _bytes2sys(os.path.join(self._threadtmp, b'.hgrc')) | |
@@ -2503,7 +2500,7 b' class TestSuite(unittest.TestSuite):' | |||||
2503 |
|
2500 | |||
2504 | if ignored: |
|
2501 | if ignored: | |
2505 | continue |
|
2502 | continue | |
2506 |
for _ in |
|
2503 | for _ in range(self._runs_per_test): | |
2507 | tests.append(get()) |
|
2504 | tests.append(get()) | |
2508 |
|
2505 | |||
2509 | runtests = list(tests) |
|
2506 | runtests = list(tests) | |
@@ -2552,7 +2549,7 b' class TestSuite(unittest.TestSuite):' | |||||
2552 | with iolock: |
|
2549 | with iolock: | |
2553 | sys.stdout.write(d + ' ') |
|
2550 | sys.stdout.write(d + ' ') | |
2554 | sys.stdout.flush() |
|
2551 | sys.stdout.flush() | |
2555 |
for x in |
|
2552 | for x in range(10): | |
2556 | if channels: |
|
2553 | if channels: | |
2557 | time.sleep(0.1) |
|
2554 | time.sleep(0.1) | |
2558 | count += 1 |
|
2555 | count += 1 | |
@@ -3502,10 +3499,10 b' class TestRunner:' | |||||
3502 | if port is None: |
|
3499 | if port is None: | |
3503 | portneeded = 3 |
|
3500 | portneeded = 3 | |
3504 | # above 100 tries we just give up and let test reports failure |
|
3501 | # above 100 tries we just give up and let test reports failure | |
3505 |
for tries in |
|
3502 | for tries in range(100): | |
3506 | allfree = True |
|
3503 | allfree = True | |
3507 | port = self.options.port + self._portoffset |
|
3504 | port = self.options.port + self._portoffset | |
3508 |
for idx in |
|
3505 | for idx in range(portneeded): | |
3509 | if not checkportisavailable(port + idx): |
|
3506 | if not checkportisavailable(port + idx): | |
3510 | allfree = False |
|
3507 | allfree = False | |
3511 | break |
|
3508 | break |
@@ -19,9 +19,6 b' try:' | |||||
19 | except ImportError: |
|
19 | except ImportError: | |
20 | pass |
|
20 | pass | |
21 |
|
21 | |||
22 | if sys.version_info[0] >= 3: |
|
|||
23 | xrange = range |
|
|||
24 |
|
||||
25 | start = 1 |
|
22 | start = 1 | |
26 | if len(sys.argv) > 2: |
|
23 | if len(sys.argv) > 2: | |
27 | start = int(sys.argv[1]) |
|
24 | start = int(sys.argv[1]) | |
@@ -32,5 +29,5 b' if len(sys.argv) > 3:' | |||||
32 |
|
29 | |||
33 | stop = int(sys.argv[-1]) + 1 |
|
30 | stop = int(sys.argv[-1]) + 1 | |
34 |
|
31 | |||
35 |
for i in |
|
32 | for i in range(start, stop, step): | |
36 | print(i) |
|
33 | print(i) |
@@ -18,7 +18,6 b' from mercurial import (' | |||||
18 |
|
18 | |||
19 | if pycompat.ispy3: |
|
19 | if pycompat.ispy3: | |
20 | long = int |
|
20 | long = int | |
21 | xrange = range |
|
|||
22 |
|
21 | |||
23 |
|
22 | |||
24 | def buildgraph(rng, nodes=100, rootprob=0.05, mergeprob=0.2, prevprob=0.7): |
|
23 | def buildgraph(rng, nodes=100, rootprob=0.05, mergeprob=0.2, prevprob=0.7): | |
@@ -30,7 +29,7 b' def buildgraph(rng, nodes=100, rootprob=' | |||||
30 | return value is a graph represented as an adjacency list. |
|
29 | return value is a graph represented as an adjacency list. | |
31 | """ |
|
30 | """ | |
32 | graph = [None] * nodes |
|
31 | graph = [None] * nodes | |
33 |
for i in |
|
32 | for i in range(nodes): | |
34 | if i == 0 or rng.random() < rootprob: |
|
33 | if i == 0 or rng.random() < rootprob: | |
35 | graph[i] = [nullrev] |
|
34 | graph[i] = [nullrev] | |
36 | elif i == 1: |
|
35 | elif i == 1: | |
@@ -53,7 +52,7 b' def buildgraph(rng, nodes=100, rootprob=' | |||||
53 |
|
52 | |||
54 | def buildancestorsets(graph): |
|
53 | def buildancestorsets(graph): | |
55 | ancs = [None] * len(graph) |
|
54 | ancs = [None] * len(graph) | |
56 |
for i in |
|
55 | for i in range(len(graph)): | |
57 | ancs[i] = {i} |
|
56 | ancs[i] = {i} | |
58 | if graph[i] == [nullrev]: |
|
57 | if graph[i] == [nullrev]: | |
59 | continue |
|
58 | continue | |
@@ -114,11 +113,11 b' def test_missingancestors(seed, rng):' | |||||
114 | nerrs[0] += 1 |
|
113 | nerrs[0] += 1 | |
115 | gerrs[0] += 1 |
|
114 | gerrs[0] += 1 | |
116 |
|
115 | |||
117 |
for g in |
|
116 | for g in range(graphcount): | |
118 | graph = buildgraph(rng) |
|
117 | graph = buildgraph(rng) | |
119 | ancs = buildancestorsets(graph) |
|
118 | ancs = buildancestorsets(graph) | |
120 | gerrs = [0] |
|
119 | gerrs = [0] | |
121 |
for _ in |
|
120 | for _ in range(testcount): | |
122 | # start from nullrev to include it as a possibility |
|
121 | # start from nullrev to include it as a possibility | |
123 | graphnodes = range(nullrev, len(graph)) |
|
122 | graphnodes = range(nullrev, len(graph)) | |
124 | bases = samplerevs(graphnodes) |
|
123 | bases = samplerevs(graphnodes) | |
@@ -128,7 +127,7 b' def test_missingancestors(seed, rng):' | |||||
128 | # reference slow algorithm |
|
127 | # reference slow algorithm | |
129 | naiveinc = naiveincrementalmissingancestors(ancs, bases) |
|
128 | naiveinc = naiveincrementalmissingancestors(ancs, bases) | |
130 | seq = [] |
|
129 | seq = [] | |
131 |
for _ in |
|
130 | for _ in range(inccount): | |
132 | if rng.random() < 0.2: |
|
131 | if rng.random() < 0.2: | |
133 | newbases = samplerevs(graphnodes) |
|
132 | newbases = samplerevs(graphnodes) | |
134 | seq.append(('addbases', newbases)) |
|
133 | seq.append(('addbases', newbases)) | |
@@ -215,7 +214,7 b' def test_missingancestors_explicit():' | |||||
215 | """ |
|
214 | """ | |
216 | for i, (bases, revs) in enumerate( |
|
215 | for i, (bases, revs) in enumerate( | |
217 | ( |
|
216 | ( | |
218 |
({1, 2, 3, 4, 7}, set( |
|
217 | ({1, 2, 3, 4, 7}, set(range(10))), | |
219 | ({10}, set({11, 12, 13, 14})), |
|
218 | ({10}, set({11, 12, 13, 14})), | |
220 | ({7}, set({1, 2, 3, 4, 5})), |
|
219 | ({7}, set({1, 2, 3, 4, 5})), | |
221 | ) |
|
220 | ) |
@@ -6,15 +6,11 b' import tempfile' | |||||
6 | import unittest |
|
6 | import unittest | |
7 |
|
7 | |||
8 | from mercurial import ( |
|
8 | from mercurial import ( | |
9 | pycompat, |
|
|||
10 | util, |
|
9 | util, | |
11 | ) |
|
10 | ) | |
12 |
|
11 | |||
13 | atomictempfile = util.atomictempfile |
|
12 | atomictempfile = util.atomictempfile | |
14 |
|
13 | |||
15 | if pycompat.ispy3: |
|
|||
16 | xrange = range |
|
|||
17 |
|
||||
18 |
|
14 | |||
19 | class testatomictempfile(unittest.TestCase): |
|
15 | class testatomictempfile(unittest.TestCase): | |
20 | def setUp(self): |
|
16 | def setUp(self): | |
@@ -68,7 +64,7 b' class testatomictempfile(unittest.TestCa' | |||||
68 |
|
64 | |||
69 | # try some times, because reproduction of ambiguity depends on |
|
65 | # try some times, because reproduction of ambiguity depends on | |
70 | # "filesystem time" |
|
66 | # "filesystem time" | |
71 |
for i in |
|
67 | for i in range(5): | |
72 | atomicwrite(False) |
|
68 | atomicwrite(False) | |
73 | oldstat = os.stat(self._filename) |
|
69 | oldstat = os.stat(self._filename) | |
74 | if oldstat[stat.ST_CTIME] != oldstat[stat.ST_MTIME]: |
|
70 | if oldstat[stat.ST_CTIME] != oldstat[stat.ST_MTIME]: | |
@@ -79,7 +75,7 b' class testatomictempfile(unittest.TestCa' | |||||
79 |
|
75 | |||
80 | # repeat atomic write with checkambig=True, to examine |
|
76 | # repeat atomic write with checkambig=True, to examine | |
81 | # whether st_mtime is advanced multiple times as expected |
|
77 | # whether st_mtime is advanced multiple times as expected | |
82 |
for j in |
|
78 | for j in range(repetition): | |
83 | atomicwrite(True) |
|
79 | atomicwrite(True) | |
84 | newstat = os.stat(self._filename) |
|
80 | newstat = os.stat(self._filename) | |
85 | if oldstat[stat.ST_CTIME] != newstat[stat.ST_CTIME]: |
|
81 | if oldstat[stat.ST_CTIME] != newstat[stat.ST_CTIME]: |
@@ -8,9 +8,6 b' from mercurial import (' | |||||
8 |
|
8 | |||
9 | from hgext.fastannotate import error, revmap |
|
9 | from hgext.fastannotate import error, revmap | |
10 |
|
10 | |||
11 | if pycompat.ispy3: |
|
|||
12 | xrange = range |
|
|||
13 |
|
||||
14 |
|
11 | |||
15 | def genhsh(i): |
|
12 | def genhsh(i): | |
16 | return pycompat.bytechr(i) + b'\0' * 19 |
|
13 | return pycompat.bytechr(i) + b'\0' * 19 | |
@@ -33,7 +30,7 b' def testbasicreadwrite():' | |||||
33 |
|
30 | |||
34 | rm = revmap.revmap(path) |
|
31 | rm = revmap.revmap(path) | |
35 | ensure(rm.maxrev == 0) |
|
32 | ensure(rm.maxrev == 0) | |
36 |
for i in |
|
33 | for i in range(5): | |
37 | ensure(rm.rev2hsh(i) is None) |
|
34 | ensure(rm.rev2hsh(i) is None) | |
38 | ensure(rm.hsh2rev(b'\0' * 20) is None) |
|
35 | ensure(rm.hsh2rev(b'\0' * 20) is None) | |
39 |
|
36 | |||
@@ -51,11 +48,11 b' def testbasicreadwrite():' | |||||
51 | b'a', |
|
48 | b'a', | |
52 | b'a', |
|
49 | b'a', | |
53 | ] |
|
50 | ] | |
54 |
for i in |
|
51 | for i in range(1, 5): | |
55 | ensure(rm.append(genhsh(i), sidebranch=(i & 1), path=paths[i]) == i) |
|
52 | ensure(rm.append(genhsh(i), sidebranch=(i & 1), path=paths[i]) == i) | |
56 |
|
53 | |||
57 | ensure(rm.maxrev == 4) |
|
54 | ensure(rm.maxrev == 4) | |
58 |
for i in |
|
55 | for i in range(1, 5): | |
59 | ensure(rm.hsh2rev(genhsh(i)) == i) |
|
56 | ensure(rm.hsh2rev(genhsh(i)) == i) | |
60 | ensure(rm.rev2hsh(i) == genhsh(i)) |
|
57 | ensure(rm.rev2hsh(i) == genhsh(i)) | |
61 |
|
58 | |||
@@ -63,13 +60,13 b' def testbasicreadwrite():' | |||||
63 | rm.flush() |
|
60 | rm.flush() | |
64 | rm = revmap.revmap(path) |
|
61 | rm = revmap.revmap(path) | |
65 | ensure(rm.maxrev == 4) |
|
62 | ensure(rm.maxrev == 4) | |
66 |
for i in |
|
63 | for i in range(1, 5): | |
67 | ensure(rm.hsh2rev(genhsh(i)) == i) |
|
64 | ensure(rm.hsh2rev(genhsh(i)) == i) | |
68 | ensure(rm.rev2hsh(i) == genhsh(i)) |
|
65 | ensure(rm.rev2hsh(i) == genhsh(i)) | |
69 | ensure(bool(rm.rev2flag(i) & revmap.sidebranchflag) == bool(i & 1)) |
|
66 | ensure(bool(rm.rev2flag(i) & revmap.sidebranchflag) == bool(i & 1)) | |
70 |
|
67 | |||
71 | # append without calling save() explicitly |
|
68 | # append without calling save() explicitly | |
72 |
for i in |
|
69 | for i in range(5, 12): | |
73 | ensure( |
|
70 | ensure( | |
74 | rm.append(genhsh(i), sidebranch=(i & 1), path=paths[i], flush=True) |
|
71 | rm.append(genhsh(i), sidebranch=(i & 1), path=paths[i], flush=True) | |
75 | == i |
|
72 | == i | |
@@ -78,7 +75,7 b' def testbasicreadwrite():' | |||||
78 | # re-load and verify |
|
75 | # re-load and verify | |
79 | rm = revmap.revmap(path) |
|
76 | rm = revmap.revmap(path) | |
80 | ensure(rm.maxrev == 11) |
|
77 | ensure(rm.maxrev == 11) | |
81 |
for i in |
|
78 | for i in range(1, 12): | |
82 | ensure(rm.hsh2rev(genhsh(i)) == i) |
|
79 | ensure(rm.hsh2rev(genhsh(i)) == i) | |
83 | ensure(rm.rev2hsh(i) == genhsh(i)) |
|
80 | ensure(rm.rev2hsh(i) == genhsh(i)) | |
84 | ensure(rm.rev2path(i) == paths[i] or paths[i - 1]) |
|
81 | ensure(rm.rev2path(i) == paths[i] or paths[i - 1]) | |
@@ -148,7 +145,7 b' def testcorruptformat():' | |||||
148 | def testcopyfrom(): |
|
145 | def testcopyfrom(): | |
149 | path = gettemppath() |
|
146 | path = gettemppath() | |
150 | rm = revmap.revmap(path) |
|
147 | rm = revmap.revmap(path) | |
151 |
for i in |
|
148 | for i in range(1, 10): | |
152 | ensure( |
|
149 | ensure( | |
153 | rm.append(genhsh(i), sidebranch=(i & 1), path=(b'%d' % (i // 3))) |
|
150 | rm.append(genhsh(i), sidebranch=(i & 1), path=(b'%d' % (i // 3))) | |
154 | == i |
|
151 | == i | |
@@ -185,21 +182,21 b' def testcontains():' | |||||
185 | path = gettemppath() |
|
182 | path = gettemppath() | |
186 |
|
183 | |||
187 | rm = revmap.revmap(path) |
|
184 | rm = revmap.revmap(path) | |
188 |
for i in |
|
185 | for i in range(1, 5): | |
189 | ensure(rm.append(genhsh(i), sidebranch=(i & 1)) == i) |
|
186 | ensure(rm.append(genhsh(i), sidebranch=(i & 1)) == i) | |
190 |
|
187 | |||
191 |
for i in |
|
188 | for i in range(1, 5): | |
192 | ensure(((genhsh(i), None) in rm) == ((i & 1) == 0)) |
|
189 | ensure(((genhsh(i), None) in rm) == ((i & 1) == 0)) | |
193 | ensure((fakefctx(genhsh(i)) in rm) == ((i & 1) == 0)) |
|
190 | ensure((fakefctx(genhsh(i)) in rm) == ((i & 1) == 0)) | |
194 |
for i in |
|
191 | for i in range(5, 10): | |
195 | ensure(fakefctx(genhsh(i)) not in rm) |
|
192 | ensure(fakefctx(genhsh(i)) not in rm) | |
196 | ensure((genhsh(i), None) not in rm) |
|
193 | ensure((genhsh(i), None) not in rm) | |
197 |
|
194 | |||
198 | # "contains" checks paths |
|
195 | # "contains" checks paths | |
199 | rm = revmap.revmap() |
|
196 | rm = revmap.revmap() | |
200 |
for i in |
|
197 | for i in range(1, 5): | |
201 | ensure(rm.append(genhsh(i), path=(b'%d' % (i // 2))) == i) |
|
198 | ensure(rm.append(genhsh(i), path=(b'%d' % (i // 2))) == i) | |
202 |
for i in |
|
199 | for i in range(1, 5): | |
203 | ensure(fakefctx(genhsh(i), path=(b'%d' % (i // 2))) in rm) |
|
200 | ensure(fakefctx(genhsh(i), path=(b'%d' % (i // 2))) in rm) | |
204 | ensure(fakefctx(genhsh(i), path=b'a') not in rm) |
|
201 | ensure(fakefctx(genhsh(i), path=b'a') not in rm) | |
205 |
|
202 | |||
@@ -209,7 +206,7 b' def testlastnode():' | |||||
209 | ensure(revmap.getlastnode(path) is None) |
|
206 | ensure(revmap.getlastnode(path) is None) | |
210 | rm = revmap.revmap(path) |
|
207 | rm = revmap.revmap(path) | |
211 | ensure(revmap.getlastnode(path) is None) |
|
208 | ensure(revmap.getlastnode(path) is None) | |
212 |
for i in |
|
209 | for i in range(1, 10): | |
213 | hsh = genhsh(i) |
|
210 | hsh = genhsh(i) | |
214 | rm.append(hsh, path=(b'%d' % (i // 2)), flush=True) |
|
211 | rm.append(hsh, path=(b'%d' % (i // 2)), flush=True) | |
215 | ensure(revmap.getlastnode(path) == hsh) |
|
212 | ensure(revmap.getlastnode(path) == hsh) |
@@ -31,9 +31,6 b' from mercurial import (' | |||||
31 | vfs as vfsmod, |
|
31 | vfs as vfsmod, | |
32 | ) |
|
32 | ) | |
33 |
|
33 | |||
34 | if pycompat.ispy3: |
|
|||
35 | xrange = range |
|
|||
36 |
|
||||
37 |
|
34 | |||
38 | class fakerepo: |
|
35 | class fakerepo: | |
39 | def __init__(self): |
|
36 | def __init__(self): | |
@@ -214,7 +211,7 b' def antiambiguity():' | |||||
214 |
|
211 | |||
215 | # try some times, because reproduction of ambiguity depends on |
|
212 | # try some times, because reproduction of ambiguity depends on | |
216 | # "filesystem time" |
|
213 | # "filesystem time" | |
217 |
for i in |
|
214 | for i in range(5): | |
218 | fp = open(filename, 'w') |
|
215 | fp = open(filename, 'w') | |
219 | fp.write('FOO') |
|
216 | fp.write('FOO') | |
220 | fp.close() |
|
217 | fp.close() | |
@@ -228,7 +225,7 b' def antiambiguity():' | |||||
228 |
|
225 | |||
229 | # repeat changing via checkambigatclosing, to examine whether |
|
226 | # repeat changing via checkambigatclosing, to examine whether | |
230 | # st_mtime is advanced multiple times as expected |
|
227 | # st_mtime is advanced multiple times as expected | |
231 |
for i in |
|
228 | for i in range(repetition): | |
232 | # explicit closing |
|
229 | # explicit closing | |
233 | fp = vfsmod.checkambigatclosing(open(filename, 'a')) |
|
230 | fp = vfsmod.checkambigatclosing(open(filename, 'a')) | |
234 | fp.write('FOO') |
|
231 | fp.write('FOO') |
@@ -59,14 +59,12 b' A_DEEPER_MANIFEST = (' | |||||
59 | HUGE_MANIFEST_ENTRIES = 200001 |
|
59 | HUGE_MANIFEST_ENTRIES = 200001 | |
60 |
|
60 | |||
61 | izip = getattr(itertools, 'izip', zip) |
|
61 | izip = getattr(itertools, 'izip', zip) | |
62 | if 'xrange' not in globals(): |
|
|||
63 | xrange = range |
|
|||
64 |
|
62 | |||
65 | A_HUGE_MANIFEST = b''.join( |
|
63 | A_HUGE_MANIFEST = b''.join( | |
66 | sorted( |
|
64 | sorted( | |
67 | b'file%d\0%s%s\n' % (i, h, f) |
|
65 | b'file%d\0%s%s\n' % (i, h, f) | |
68 | for i, h, f in izip( |
|
66 | for i, h, f in izip( | |
69 |
|
|
67 | range(200001), | |
70 | itertools.cycle((HASH_1, HASH_2)), |
|
68 | itertools.cycle((HASH_1, HASH_2)), | |
71 | itertools.cycle((b'', b'x', b'l')), |
|
69 | itertools.cycle((b'', b'x', b'l')), | |
72 | ) |
|
70 | ) |
@@ -19,11 +19,6 b' from mercurial import (' | |||||
19 | store, |
|
19 | store, | |
20 | ) |
|
20 | ) | |
21 |
|
21 | |||
22 | try: |
|
|||
23 | xrange |
|
|||
24 | except NameError: |
|
|||
25 | xrange = range |
|
|||
26 |
|
||||
27 | validchars = set(map(pycompat.bytechr, range(0, 256))) |
|
22 | validchars = set(map(pycompat.bytechr, range(0, 256))) | |
28 | alphanum = range(ord('A'), ord('Z')) |
|
23 | alphanum = range(ord('A'), ord('Z')) | |
29 |
|
24 | |||
@@ -32,8 +27,8 b" for c in (b'\\0', b'/'):" | |||||
32 |
|
27 | |||
33 | winreserved = ( |
|
28 | winreserved = ( | |
34 | b'aux con prn nul'.split() |
|
29 | b'aux con prn nul'.split() | |
35 |
+ [b'com%d' % i for i in |
|
30 | + [b'com%d' % i for i in range(1, 10)] | |
36 |
+ [b'lpt%d' % i for i in |
|
31 | + [b'lpt%d' % i for i in range(1, 10)] | |
37 | ) |
|
32 | ) | |
38 |
|
33 | |||
39 |
|
34 | |||
@@ -43,8 +38,8 b' def casecombinations(names):' | |||||
43 | combos = set() |
|
38 | combos = set() | |
44 |
|
39 | |||
45 | for r in names: |
|
40 | for r in names: | |
46 |
for i in |
|
41 | for i in range(len(r) + 1): | |
47 |
for c in itertools.combinations( |
|
42 | for c in itertools.combinations(range(len(r)), i): | |
48 | d = r |
|
43 | d = r | |
49 | for j in c: |
|
44 | for j in c: | |
50 | d = b''.join((d[:j], d[j : j + 1].upper(), d[j + 1 :])) |
|
45 | d = b''.join((d[:j], d[j : j + 1].upper(), d[j + 1 :])) | |
@@ -211,7 +206,7 b' def makepath(rng, j, k):' | |||||
211 |
|
206 | |||
212 | return ( |
|
207 | return ( | |
213 | b'data/' |
|
208 | b'data/' | |
214 |
+ b'/'.join(makepart(rng, k) for _ in |
|
209 | + b'/'.join(makepart(rng, k) for _ in range(j)) | |
215 | + rng.choice([b'.d', b'.i']) |
|
210 | + rng.choice([b'.d', b'.i']) | |
216 | ) |
|
211 | ) | |
217 |
|
212 | |||
@@ -222,7 +217,7 b' def genpath(rng, count):' | |||||
222 | mink, maxk = 1, 4096 |
|
217 | mink, maxk = 1, 4096 | |
223 |
|
218 | |||
224 | def steps(): |
|
219 | def steps(): | |
225 |
for i in |
|
220 | for i in range(count): | |
226 | yield mink + int(round(math.sqrt((maxk - mink) * float(i) / count))) |
|
221 | yield mink + int(round(math.sqrt((maxk - mink) * float(i) / count))) | |
227 |
|
222 | |||
228 | for k in steps(): |
|
223 | for k in steps(): |
@@ -18,8 +18,6 b'' | |||||
18 | > import os |
|
18 | > import os | |
19 | > import shutil |
|
19 | > import shutil | |
20 | > import sys |
|
20 | > import sys | |
21 | > if sys.version_info[0] > 2: |
|
|||
22 | > xrange = range |
|
|||
23 | > f = open('$TESTTMP/cachelog.log', 'w') |
|
21 | > f = open('$TESTTMP/cachelog.log', 'w') | |
24 | > srccache = os.path.join('$TESTTMP', 'oldhgcache') |
|
22 | > srccache = os.path.join('$TESTTMP', 'oldhgcache') | |
25 | > def log(message): |
|
23 | > def log(message): | |
@@ -36,7 +34,7 b'' | |||||
36 | > count = int(sys.stdin.readline()) |
|
34 | > count = int(sys.stdin.readline()) | |
37 | > log('client wants %r blobs\n' % count) |
|
35 | > log('client wants %r blobs\n' % count) | |
38 | > wants = [] |
|
36 | > wants = [] | |
39 |
> for _ in |
|
37 | > for _ in range(count): | |
40 | > key = sys.stdin.readline()[:-1] |
|
38 | > key = sys.stdin.readline()[:-1] | |
41 | > wants.append(key) |
|
39 | > wants.append(key) | |
42 | > if '\0' in key: |
|
40 | > if '\0' in key: |
@@ -4,9 +4,6 b' from mercurial import (' | |||||
4 | ui as uimod, |
|
4 | ui as uimod, | |
5 | ) |
|
5 | ) | |
6 |
|
6 | |||
7 | if pycompat.ispy3: |
|
|||
8 | xrange = range |
|
|||
9 |
|
||||
10 | hgrc = os.environ['HGRCPATH'] |
|
7 | hgrc = os.environ['HGRCPATH'] | |
11 | f = open(hgrc) |
|
8 | f = open(hgrc) | |
12 | basehgrc = f.read() |
|
9 | basehgrc = f.read() | |
@@ -15,7 +12,7 b' f.close()' | |||||
15 | print(' hgrc settings command line options final result ') |
|
12 | print(' hgrc settings command line options final result ') | |
16 | print(' quiet verbo debug quiet verbo debug quiet verbo debug') |
|
13 | print(' quiet verbo debug quiet verbo debug quiet verbo debug') | |
17 |
|
14 | |||
18 |
for i in |
|
15 | for i in range(64): | |
19 | hgrc_quiet = bool(i & 1 << 0) |
|
16 | hgrc_quiet = bool(i & 1 << 0) | |
20 | hgrc_verbose = bool(i & 1 << 1) |
|
17 | hgrc_verbose = bool(i & 1 << 1) | |
21 | hgrc_debug = bool(i & 1 << 2) |
|
18 | hgrc_debug = bool(i & 1 << 2) |
General Comments 0
You need to be logged in to leave comments.
Login now