Skip to content

Commit 4b0597a

Browse files
authored
Merge pull request #9912 from graydon/minor-script-tweaks
2 parents 4c6ece6 + 09b4753 commit 4b0597a

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

utils/rusage.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,13 @@ def __call__(self, parser, namespace, v, option_string=None):
9191
action='store_true',
9292
default=False,
9393
help="write results as CSV")
94+
parser.add_argument("--csv-header",
95+
action='store_true',
96+
default=False,
97+
help="Emit CSV header")
9498
parser.add_argument("--csv-output", default="-",
95-
type=argparse.FileType('ab', 0),
96-
help="Append CSV output to file")
99+
type=argparse.FileType('wb', 0),
100+
help="Write CSV output to file")
97101
parser.add_argument("--csv-name", type=str,
98102
default=str(datetime.datetime.now()),
99103
help="Label row in CSV with name")
@@ -147,7 +151,7 @@ def __call__(self, parser, namespace, v, option_string=None):
147151
if args.csv:
148152
fieldnames = ["time", "mem", "run"]
149153
out = csv.DictWriter(args.csv_output, fieldnames, dialect='excel-tab')
150-
if args.csv_output.tell() == 0:
154+
if args.csv_header:
151155
out.writeheader()
152156
out.writerow(dict(time=used.ru_utime,
153157
mem=used.ru_maxrss,

utils/update_checkout.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ def confirm_tag_in_repo(tag, repo_name):
4242
def find_rev_by_timestamp(timestamp, repo_name, refspec):
4343
base_args = ["git", "log", "-1", "--format=%H",
4444
'--before=' + timestamp]
45-
# Prefer the most-recent change _made by swift-ci_ before the timestamp,
46-
# falling back to most-recent in general if there is none by swift-ci.
47-
rev = shell.capture(base_args + ['--author', 'swift-ci', refspec]).strip()
48-
if rev:
49-
return rev
45+
# On repos with regular batch-automerges from swift-ci -- namely clang,
46+
# llvm and lldb -- prefer the most-recent change _made by swift-ci_
47+
# before the timestamp, falling back to most-recent in general if there
48+
# is none by swift-ci.
49+
if repo_name in ["llvm", "clang", "lldb"]:
50+
rev = shell.capture(base_args +
51+
['--author', 'swift-ci', refspec]).strip()
52+
if rev:
53+
return rev
5054
rev = shell.capture(base_args + [refspec]).strip()
5155
if rev:
5256
return rev

0 commit comments

Comments
 (0)