Skip to content

Minor script tweaks #9912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions utils/rusage.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ def __call__(self, parser, namespace, v, option_string=None):
action='store_true',
default=False,
help="write results as CSV")
parser.add_argument("--csv-header",
action='store_true',
default=False,
help="Emit CSV header")
parser.add_argument("--csv-output", default="-",
type=argparse.FileType('ab', 0),
help="Append CSV output to file")
type=argparse.FileType('wb', 0),
help="Write CSV output to file")
parser.add_argument("--csv-name", type=str,
default=str(datetime.datetime.now()),
help="Label row in CSV with name")
Expand Down Expand Up @@ -147,7 +151,7 @@ def __call__(self, parser, namespace, v, option_string=None):
if args.csv:
fieldnames = ["time", "mem", "run"]
out = csv.DictWriter(args.csv_output, fieldnames, dialect='excel-tab')
if args.csv_output.tell() == 0:
if args.csv_header:
out.writeheader()
out.writerow(dict(time=used.ru_utime,
mem=used.ru_maxrss,
Expand Down
14 changes: 9 additions & 5 deletions utils/update_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ def confirm_tag_in_repo(tag, repo_name):
def find_rev_by_timestamp(timestamp, repo_name, refspec):
base_args = ["git", "log", "-1", "--format=%H",
'--before=' + timestamp]
# Prefer the most-recent change _made by swift-ci_ before the timestamp,
# falling back to most-recent in general if there is none by swift-ci.
rev = shell.capture(base_args + ['--author', 'swift-ci', refspec]).strip()
if rev:
return rev
# On repos with regular batch-automerges from swift-ci -- namely clang,
# llvm and lldb -- prefer the most-recent change _made by swift-ci_
# before the timestamp, falling back to most-recent in general if there
# is none by swift-ci.
if repo_name in ["llvm", "clang", "lldb"]:
rev = shell.capture(base_args +
['--author', 'swift-ci', refspec]).strip()
if rev:
return rev
rev = shell.capture(base_args + [refspec]).strip()
if rev:
return rev
Expand Down