python3: removed use of xrang
This commit is contained in:
parent
4fd59e6128
commit
8f6692847b
36 changed files with 67 additions and 67 deletions
|
|
@ -70,11 +70,11 @@ class TestGetRepoChangeset(object):
|
|||
result = response.json['result']
|
||||
assert result
|
||||
assert len(result) == limit
|
||||
for x in xrange(limit):
|
||||
for x in range(limit):
|
||||
assert result[x]['revision'] == x
|
||||
|
||||
if details == 'full':
|
||||
for x in xrange(limit):
|
||||
for x in range(limit):
|
||||
assert 'bookmarks' in result[x]['refs']
|
||||
assert 'branches' in result[x]['refs']
|
||||
assert 'tags' in result[x]['refs']
|
||||
|
|
@ -98,7 +98,7 @@ class TestGetRepoChangeset(object):
|
|||
result = response.json['result']
|
||||
assert result
|
||||
assert len(result) == limit
|
||||
for i in xrange(limit):
|
||||
for i in range(limit):
|
||||
assert result[i]['revision'] == int(expected_revision) + i
|
||||
|
||||
@pytest.mark.parametrize("details", ['basic', 'extended', 'full'])
|
||||
|
|
@ -126,7 +126,7 @@ class TestGetRepoChangeset(object):
|
|||
result = response.json['result']
|
||||
assert result
|
||||
assert len(result) == limit
|
||||
for i in xrange(limit):
|
||||
for i in range(limit):
|
||||
assert result[i]['revision'] == int(expected_revision) + i
|
||||
|
||||
@pytest.mark.parametrize("details", ['basic', 'extended', 'full'])
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class StatsClientBase(object):
|
|||
statsd = StatsdClient.statsd
|
||||
with statsd.timer('bucket_name', auto_send=True) as tmr:
|
||||
# This block will be timed.
|
||||
for i in xrange(0, 100000):
|
||||
for i in range(0, 100000):
|
||||
i ** 2
|
||||
# you can access time here...
|
||||
elapsed_ms = tmr.ms
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2215,7 +2215,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2281,7 +2281,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2329,7 +2329,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2352,7 +2352,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2352,7 +2352,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2404,7 +2404,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2489,7 +2489,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2495,7 +2495,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2526,7 +2526,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -1916,7 +1916,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -1919,7 +1919,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -1918,7 +1918,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -1920,7 +1920,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -1920,7 +1920,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -1963,7 +1963,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -1964,7 +1964,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -2151,7 +2151,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -288,13 +288,13 @@ class diff_match_patch:
|
|||
k1end = 0
|
||||
k2start = 0
|
||||
k2end = 0
|
||||
for d in xrange(max_d):
|
||||
for d in range(max_d):
|
||||
# Bail out if deadline is reached.
|
||||
if time.time() > deadline:
|
||||
break
|
||||
|
||||
# Walk the front path one step.
|
||||
for k1 in xrange(-d + k1start, d + 1 - k1end, 2):
|
||||
for k1 in range(-d + k1start, d + 1 - k1end, 2):
|
||||
k1_offset = v_offset + k1
|
||||
if k1 == -d or (k1 != d and
|
||||
v1[k1_offset - 1] < v1[k1_offset + 1]):
|
||||
|
|
@ -323,7 +323,7 @@ class diff_match_patch:
|
|||
return self.diff_bisectSplit(text1, text2, x1, y1, deadline)
|
||||
|
||||
# Walk the reverse path one step.
|
||||
for k2 in xrange(-d + k2start, d + 1 - k2end, 2):
|
||||
for k2 in range(-d + k2start, d + 1 - k2end, 2):
|
||||
k2_offset = v_offset + k2
|
||||
if k2 == -d or (k2 != d and
|
||||
v2[k2_offset - 1] < v2[k2_offset + 1]):
|
||||
|
|
@ -446,7 +446,7 @@ class diff_match_patch:
|
|||
diffs: Array of diff tuples.
|
||||
lineArray: Array of unique strings.
|
||||
"""
|
||||
for x in xrange(len(diffs)):
|
||||
for x in range(len(diffs)):
|
||||
text = []
|
||||
for char in diffs[x][1]:
|
||||
text.append(lineArray[ord(char)])
|
||||
|
|
@ -1042,7 +1042,7 @@ class diff_match_patch:
|
|||
chars2 = 0
|
||||
last_chars1 = 0
|
||||
last_chars2 = 0
|
||||
for x in xrange(len(diffs)):
|
||||
for x in range(len(diffs)):
|
||||
(op, text) = diffs[x]
|
||||
if op != self.DIFF_INSERT: # Equality or deletion.
|
||||
chars1 += len(text)
|
||||
|
|
@ -1301,7 +1301,7 @@ class diff_match_patch:
|
|||
bin_max = len(pattern) + len(text)
|
||||
# Empty initialization added to appease pychecker.
|
||||
last_rd = None
|
||||
for d in xrange(len(pattern)):
|
||||
for d in range(len(pattern)):
|
||||
# Scan for the best match each iteration allows for one more error.
|
||||
# Run a binary search to determine how far from 'loc' we can stray at
|
||||
# this error level.
|
||||
|
|
@ -1321,7 +1321,7 @@ class diff_match_patch:
|
|||
|
||||
rd = [0] * (finish + 2)
|
||||
rd[finish + 1] = (1 << d) - 1
|
||||
for j in xrange(finish, start - 1, -1):
|
||||
for j in range(finish, start - 1, -1):
|
||||
if len(text) <= j - 1:
|
||||
# Out of range.
|
||||
charMatch = 0
|
||||
|
|
@ -1364,7 +1364,7 @@ class diff_match_patch:
|
|||
s = {}
|
||||
for char in pattern:
|
||||
s[char] = 0
|
||||
for i in xrange(len(pattern)):
|
||||
for i in range(len(pattern)):
|
||||
s[pattern[i]] |= 1 << (len(pattern) - i - 1)
|
||||
return s
|
||||
|
||||
|
|
@ -1473,7 +1473,7 @@ class diff_match_patch:
|
|||
char_count2 = 0 # Number of characters into the text2 string.
|
||||
prepatch_text = text1 # Recreate the patches to determine context info.
|
||||
postpatch_text = text1
|
||||
for x in xrange(len(diffs)):
|
||||
for x in range(len(diffs)):
|
||||
(diff_type, diff_text) = diffs[x]
|
||||
if len(patch.diffs) == 0 and diff_type != self.DIFF_EQUAL:
|
||||
# A new patch starts here.
|
||||
|
|
@ -1646,7 +1646,7 @@ class diff_match_patch:
|
|||
"""
|
||||
paddingLength = self.Patch_Margin
|
||||
nullPadding = ""
|
||||
for x in xrange(1, paddingLength + 1):
|
||||
for x in range(1, paddingLength + 1):
|
||||
nullPadding += chr(x)
|
||||
|
||||
# Bump all the patches forward.
|
||||
|
|
@ -1705,7 +1705,7 @@ class diff_match_patch:
|
|||
# Python has the option of not splitting strings due to its ability
|
||||
# to handle integers of arbitrary precision.
|
||||
return
|
||||
for x in xrange(len(patches)):
|
||||
for x in range(len(patches)):
|
||||
if patches[x].length1 <= patch_size:
|
||||
continue
|
||||
bigpatch = patches[x]
|
||||
|
|
|
|||
|
|
@ -581,7 +581,7 @@ def unique_color_generator(n=10000, saturation=0.10, lightness=0.95):
|
|||
golden_ratio = 0.618033988749895
|
||||
h = 0.22717784590367374
|
||||
|
||||
for _ in xrange(n):
|
||||
for _ in range(n):
|
||||
h += golden_ratio
|
||||
h %= 1
|
||||
HSV_tuple = [h, saturation, lightness]
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import sys
|
|||
import logging
|
||||
|
||||
|
||||
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = xrange(30, 38)
|
||||
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(30, 38)
|
||||
|
||||
# Sequences
|
||||
RESET_SEQ = "\033[0m"
|
||||
|
|
|
|||
|
|
@ -1259,7 +1259,7 @@ class BaseCommit(object):
|
|||
|
||||
:param branch: show commits within the given named branch
|
||||
"""
|
||||
indexes = xrange(self.idx + 1, self.repository.count())
|
||||
indexes = range(self.idx + 1, self.repository.count())
|
||||
return self._find_next(indexes, branch)
|
||||
|
||||
def prev(self, branch=None):
|
||||
|
|
@ -1269,7 +1269,7 @@ class BaseCommit(object):
|
|||
|
||||
:param branch: show commit within the given named branch
|
||||
"""
|
||||
indexes = xrange(self.idx - 1, -1, -1)
|
||||
indexes = range(self.idx - 1, -1, -1)
|
||||
return self._find_next(indexes, branch)
|
||||
|
||||
def _find_next(self, indexes, branch=None):
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class SubversionRepository(base.BaseRepository):
|
|||
@CachedProperty
|
||||
def commit_ids(self):
|
||||
head = self._remote.lookup(None)
|
||||
return [str(r) for r in xrange(1, head + 1)]
|
||||
return [str(r) for r in range(1, head + 1)]
|
||||
|
||||
def _rebuild_cache(self, commit_ids):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ def in_filter_generator(qry, items, limit=500):
|
|||
items = [-1]
|
||||
|
||||
parts = []
|
||||
for chunk in xrange(0, len(items), limit):
|
||||
for chunk in range(0, len(items), limit):
|
||||
parts.append(
|
||||
qry.in_(items[chunk: chunk + limit])
|
||||
)
|
||||
|
|
@ -2548,7 +2548,7 @@ class Repository(Base, BaseModel):
|
|||
# Try doing the filtering in chunks to avoid hitting limits
|
||||
size = 500
|
||||
status_results = []
|
||||
for chunk in xrange(0, len(revisions), size):
|
||||
for chunk in range(0, len(revisions), size):
|
||||
status_results += statuses.filter(
|
||||
ChangesetStatus.revision.in_(
|
||||
revisions[chunk: chunk+size])
|
||||
|
|
|
|||
|
|
@ -55,20 +55,20 @@ def data():
|
|||
|
||||
def test_reuse_app_no_data(repeat, vcsserver_http_echo_app):
|
||||
app = vcs_http_app(vcsserver_http_echo_app)
|
||||
for x in xrange(repeat / 10):
|
||||
for x in range(repeat / 10):
|
||||
response = app.post('/')
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_reuse_app_with_data(data, repeat, vcsserver_http_echo_app):
|
||||
app = vcs_http_app(vcsserver_http_echo_app)
|
||||
for x in xrange(repeat / 10):
|
||||
for x in range(repeat / 10):
|
||||
response = app.post('/', params=data)
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_create_app_per_request_no_data(repeat, vcsserver_http_echo_app):
|
||||
for x in xrange(repeat / 10):
|
||||
for x in range(repeat / 10):
|
||||
app = vcs_http_app(vcsserver_http_echo_app)
|
||||
response = app.post('/')
|
||||
assert response.status_code == 200
|
||||
|
|
@ -76,7 +76,7 @@ def test_create_app_per_request_no_data(repeat, vcsserver_http_echo_app):
|
|||
|
||||
def test_create_app_per_request_with_data(
|
||||
data, repeat, vcsserver_http_echo_app):
|
||||
for x in xrange(repeat / 10):
|
||||
for x in range(repeat / 10):
|
||||
app = vcs_http_app(vcsserver_http_echo_app)
|
||||
response = app.post('/', params=data)
|
||||
assert response.status_code == 200
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class Repository(object):
|
|||
log.error('api: {}'.format(e))
|
||||
|
||||
def create_commits(self, number, file_size):
|
||||
for i in xrange(number):
|
||||
for i in range(number):
|
||||
file_name = self.FILE_NAME_TEMPLATE.format(i)
|
||||
log.debug("Create commit[{}] {}".format(self.name, file_name))
|
||||
self._create_file(file_name, file_size)
|
||||
|
|
@ -275,7 +275,7 @@ class Benchmark(object):
|
|||
|
||||
def _create_repos(self):
|
||||
log.info("Creating repositories...")
|
||||
for i in xrange(self.config.repositories):
|
||||
for i in range(self.config.repositories):
|
||||
self.git_repos.append(self._create_repo('git', i))
|
||||
self.hg_repos.append(self._create_repo('hg', i))
|
||||
|
||||
|
|
|
|||
|
|
@ -830,7 +830,7 @@ class VcsBackend(object):
|
|||
|
||||
commits = commits or [
|
||||
{'message': 'Commit %s of %s' % (x, repo_name)}
|
||||
for x in xrange(number_of_commits)]
|
||||
for x in range(number_of_commits)]
|
||||
_add_commits_to_repo(repo, commits)
|
||||
return repo
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ def generate_repo_with_commits(vcs_repo):
|
|||
|
||||
def commit_generator(num):
|
||||
start_date = datetime.datetime(2010, 1, 1, 20)
|
||||
for x in xrange(num):
|
||||
for x in range(num):
|
||||
yield {
|
||||
'message': 'Commit %d' % x,
|
||||
'author': 'Joe Doe <joe.doe@example.com>',
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class TestCommitsInNonEmptyRepo(BackendTestMixin):
|
|||
@classmethod
|
||||
def _get_commits(cls):
|
||||
start_date = datetime.datetime(2010, 1, 1, 20)
|
||||
for x in xrange(5):
|
||||
for x in range(5):
|
||||
yield {
|
||||
'message': 'Commit %d' % x,
|
||||
'author': 'Joe Doe <joe.doe@example.com>',
|
||||
|
|
@ -208,7 +208,7 @@ class TestCommits(BackendTestMixin):
|
|||
@classmethod
|
||||
def _get_commits(cls):
|
||||
start_date = datetime.datetime(2010, 1, 1, 20)
|
||||
for x in xrange(5):
|
||||
for x in range(5):
|
||||
yield {
|
||||
'message': u'Commit %d' % x,
|
||||
'author': u'Joe Doe <joe.doe@example.com>',
|
||||
|
|
@ -321,7 +321,7 @@ class TestCommits(BackendTestMixin):
|
|||
def test_get_filenodes_generator(self):
|
||||
tip = self.repo.get_commit()
|
||||
filepaths = [node.path for node in tip.get_filenodes_generator()]
|
||||
assert filepaths == ['file_%d.txt' % x for x in xrange(5)]
|
||||
assert filepaths == ['file_%d.txt' % x for x in range(5)]
|
||||
|
||||
def test_get_file_annotate(self):
|
||||
file_added_commit = self.repo.get_commit(commit_idx=3)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class TestGetitem(BackendTestMixin):
|
|||
@classmethod
|
||||
def _get_commits(cls):
|
||||
start_date = datetime.datetime(2010, 1, 1, 20)
|
||||
for x in xrange(5):
|
||||
for x in range(5):
|
||||
yield {
|
||||
'message': 'Commit %d' % x,
|
||||
'author': 'Joe Doe <joe.doe@example.com>',
|
||||
|
|
@ -55,7 +55,7 @@ class TestGetitem(BackendTestMixin):
|
|||
assert self.repo[offset].message == message
|
||||
|
||||
def test_returns_correct_items(self):
|
||||
commits = [self.repo[x] for x in xrange(len(self.repo.commit_ids))]
|
||||
commits = [self.repo[x] for x in range(len(self.repo.commit_ids))]
|
||||
assert commits == list(self.repo.get_commits())
|
||||
|
||||
def test_raises_for_next_commit(self):
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class TestGetslice(BackendTestMixin):
|
|||
@classmethod
|
||||
def _get_commits(cls):
|
||||
start_date = datetime.datetime(2010, 1, 1, 20)
|
||||
for x in xrange(5):
|
||||
for x in range(5):
|
||||
yield {
|
||||
'message': 'Commit %d' % x,
|
||||
'author': 'Joe Doe <joe.doe@example.com>',
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ class TestInMemoryCommit(BackendTestMixin):
|
|||
def test_multiple_commits(self):
|
||||
N = 3 # number of commits to perform
|
||||
last = None
|
||||
for x in xrange(N):
|
||||
for x in range(N):
|
||||
fname = 'file%s' % str(x).rjust(5, '0')
|
||||
content = 'foobar\n' * x
|
||||
node = FileNode(fname, content=content)
|
||||
|
|
|
|||
|
|
@ -270,6 +270,6 @@ class TestNodesCommits(BackendTestMixin):
|
|||
repo = generate_repo_with_commits(20)
|
||||
last_commit = repo.get_commit()
|
||||
|
||||
for x in xrange(3):
|
||||
for x in range(3):
|
||||
node = last_commit.get_node('file_%s.txt' % x)
|
||||
assert node.last_commit == repo[x]
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ class TestRepositoryStrip(BackendTestMixin):
|
|||
],
|
||||
},
|
||||
]
|
||||
for x in xrange(10):
|
||||
for x in range(10):
|
||||
commit_data = {
|
||||
'message': 'Changed foobar - commit%s' % x,
|
||||
'author': 'Jane Doe <jane.doe@example.com>',
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ def get_normalized_path(path):
|
|||
return get_normalized_path(newpath)
|
||||
else:
|
||||
start = int(m.group(1)[-5:]) + 1
|
||||
for x in xrange(start, 10000):
|
||||
for x in range(start, 10000):
|
||||
newname = name[:-5] + str(x).rjust(5, '0')
|
||||
newpath = os.path.join(dir, newname)
|
||||
if ext:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue