| 1 |
import argparse |
| 2 |
import os |
| 3 |
import zipfile |
| 4 |
|
| 5 |
ap = argparse.ArgumentParser() |
| 6 |
ap.add_argument("out", metavar="some.zip", type=str, nargs=1) |
| 7 |
args = ap.parse_args() |
| 8 |
|
| 9 |
reporoot = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')) |
| 10 |
# typically a standalone index |
| 11 |
changelog = os.path.join(reporoot, '.hg', 'store', '00changelog.i') |
| 12 |
# an inline revlog with only a few revisions |
| 13 |
contributing = os.path.join( |
| 14 |
reporoot, '.hg', 'store', 'data', 'contrib', 'fuzz', 'mpatch.cc.i' |
| 15 |
) |
| 16 |
|
| 17 |
with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf: |
| 18 |
if os.path.exists(changelog): |
| 19 |
with open(changelog, 'rb') as f: |
| 20 |
zf.writestr("00changelog.i", f.read()) |
| 21 |
if os.path.exists(contributing): |
| 22 |
with open(contributing, 'rb') as f: |
| 23 |
zf.writestr("contributing.i", f.read()) |