mirror of
https://github.com/facebook/sapling.git
synced 2024-12-26 14:34:34 +03:00
ab3a7cb21f
Summary: In preparation for merging fb-mercurial sources to the Eden repository, move everything from the top-level directory into an `eden/scm` subdirectory.
25 lines
594 B
Python
Executable File
25 lines
594 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import argparse
|
|
|
|
|
|
if __name__ == "__main__":
|
|
ap = argparse.ArgumentParser(usage="%(prog)s [options] file...")
|
|
ap.add_argument(
|
|
"-s",
|
|
"--size",
|
|
type=int,
|
|
default=0,
|
|
help="size in bytes to truncate to",
|
|
metavar="BYTES",
|
|
)
|
|
ap.add_argument("file", nargs="+", help="file to truncate", metavar="FILE")
|
|
args = ap.parse_args()
|
|
|
|
size = args.size
|
|
if size < 0:
|
|
ap.error("size cannot be negative")
|
|
for filename in args.file:
|
|
with open(filename, "a+b") as f:
|
|
f.truncate(size)
|