Mercurial > public > mercurial-scm > hg-stable
diff tests/artifacts/scripts/generate-churning-bundle.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 5f198b690301 |
children | 1fcf79e9943a |
line wrap: on
line diff
--- 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 <filename> to be at appropriate content for iteration <idx>""" 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)) -