Mercurial > public > mercurial-scm > hg
comparison tests/artifacts/scripts/generate-churning-bundle.py @ 43110:1fcf79e9943a
tests: use range() in generate-churning-module.py
This is a test-only script. Performance on Python 2 for creating a
full list instead of a generator doesn't matter.
With this change, test-check-pyflakes.t passes on Python 3!
Differential Revision: https://phab.mercurial-scm.org/D7019
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 07 Oct 2019 10:34:21 -0400 |
parents | 2372284d9457 |
children | c102b704edb5 |
comparison
equal
deleted
inserted
replaced
43109:f244da1fc4c6 | 43110:1fcf79e9943a |
---|---|
60 if iteridx is None: | 60 if iteridx is None: |
61 current = '' | 61 current = '' |
62 else: | 62 else: |
63 current = str(iteridx) | 63 current = str(iteridx) |
64 | 64 |
65 for idx in xrange(NB_LINES): | 65 for idx in range(NB_LINES): |
66 do_change_line = True | 66 do_change_line = True |
67 if oldcontent is not None and ALWAYS_CHANGE_LINES < idx: | 67 if oldcontent is not None and ALWAYS_CHANGE_LINES < idx: |
68 do_change_line = not ((idx - iteridx) % OTHER_CHANGES) | 68 do_change_line = not ((idx - iteridx) % OTHER_CHANGES) |
69 | 69 |
70 if do_change_line: | 70 if do_change_line: |
111 try: | 111 try: |
112 os.chdir(tmpdir) | 112 os.chdir(tmpdir) |
113 hg('init') | 113 hg('init') |
114 updatefile(FILENAME, None) | 114 updatefile(FILENAME, None) |
115 hg('commit', '--addremove', '--message', 'initial commit') | 115 hg('commit', '--addremove', '--message', 'initial commit') |
116 for idx in xrange(1, NB_CHANGESET + 1): | 116 for idx in range(1, NB_CHANGESET + 1): |
117 if sys.stdout.isatty(): | 117 if sys.stdout.isatty(): |
118 print("generating commit #%d/%d" % (idx, NB_CHANGESET)) | 118 print("generating commit #%d/%d" % (idx, NB_CHANGESET)) |
119 if (idx % PERIOD_BRANCHING) == 0: | 119 if (idx % PERIOD_BRANCHING) == 0: |
120 move_back = MOVE_BACK_MIN + (idx % MOVE_BACK_RANGE) | 120 move_back = MOVE_BACK_MIN + (idx % MOVE_BACK_RANGE) |
121 hg('update', ".~%d" % move_back) | 121 hg('update', ".~%d" % move_back) |