diff options
author | Martin Peres <martin.peres@linux.intel.com> | 2015-09-02 13:38:21 +0300 |
---|---|---|
committer | Martin Peres <martin.peres@linux.intel.com> | 2015-09-02 13:38:21 +0300 |
commit | e971db06df64ea3aff771ebc4ccca68fcb43edb3 (patch) | |
tree | 629b09129aeb6fd21f28360c395f0628b4c5b429 | |
parent | 79c63bddfe928ec117da970c979c62d6674d74c3 (diff) |
utils/gen_date_labels: add an application to generate date labels for commits
-rwxr-xr-x | utils/gen_date_labels.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/utils/gen_date_labels.py b/utils/gen_date_labels.py new file mode 100755 index 0000000..b8104db --- /dev/null +++ b/utils/gen_date_labels.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +from ezbench import * +import subprocess +import argparse +import sys +import os + +# Start by checking what the user wants to monitor! +parser = argparse.ArgumentParser() +parser.add_argument("--path", "-p", help="Repository path") +parser.add_argument("log_folder") +args = parser.parse_args() + +if len(args.path) == 0: + print ("You need to specify a path to the git repo using -p.") + exit(1) + +labels_path = os.path.abspath(args.log_folder + "/commit_labels") +if os.path.exists(labels_path): + shouldAbort = input("The commit labels file '{}' already exists and will be deleted.\nAbort? (y/N)".format(labels_path)).lower() == 'y' + if shouldAbort: + exit(0) + print() +f = open(labels_path, 'w') + +report = genPerformanceReport(args.log_folder, False) + +# Move to the repo's list +os.chdir(args.path) + +for commit in report.commits: + gitCommandLine = ["/usr/bin/git", "show", "--format=%cI", "--date=local", "-s", commit.sha1] + date = subprocess.check_output(gitCommandLine).decode().split('T')[0] + val = "{commit_sha1} {label}\n".format(commit_sha1=commit.sha1, label=date) + f.write(val) + print(val, end="") +print("Output written to '{}'".format(labels_path))
\ No newline at end of file |