diff -r 57875cf423c9 -r 2372284d9457 tests/artifacts/scripts/generate-churning-bundle.py --- a/tests/artifacts/scripts/generate-churning-bundle.py Sat Oct 05 10:29:34 2019 -0400 +++ b/tests/artifacts/scripts/generate-churning-bundle.py Sun Oct 06 09:45:02 2019 -0400 @@ -39,15 +39,17 @@ # # At each revision, the beginning on the file change, # and set of other lines changes too. -FILENAME='SPARSE-REVLOG-TEST-FILE' +FILENAME = 'SPARSE-REVLOG-TEST-FILE' NB_LINES = 10500 ALWAYS_CHANGE_LINES = 500 OTHER_CHANGES = 300 + def nextcontent(previous_content): """utility to produce a new file content from the previous one""" return hashlib.md5(previous_content).hexdigest() + def filecontent(iteridx, oldcontent): """generate a new file content @@ -72,6 +74,7 @@ to_write = oldcontent[idx] yield to_write + def updatefile(filename, idx): """update to be at appropriate content for iteration """ existing = None @@ -82,6 +85,7 @@ for line in filecontent(idx, existing): target.write(line) + def hg(command, *args): """call a mercurial command with appropriate config and argument""" env = os.environ.copy() @@ -101,6 +105,7 @@ env['HGRCPATH'] = '' return subprocess.check_call(full_cmd, env=env) + def run(target): tmpdir = tempfile.mkdtemp(prefix='tmp-hg-test-big-file-bundle-') try: @@ -131,8 +136,8 @@ shutil.rmtree(tmpdir) return 0 + if __name__ == '__main__': orig = os.path.realpath(os.path.dirname(sys.argv[0])) target = os.path.join(orig, os.pardir, 'cache', BUNDLE_NAME) sys.exit(run(target)) -