Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: mojo/public/tools/gn/last_commit_timestamp.py

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/tools/download_shell_binary.py ('k') | mojo/public/tools/gn/unzip.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Outputs the timestamp of the last commit in a Git repository."""
8
9 import argparse
10 import subprocess
11 import sys
12
13 def get_timestamp(directory):
14 return subprocess.check_output(["git", "log", "-1", "--pretty=format:%ct"],
15 cwd=directory)
16
17 def main():
18 parser = argparse.ArgumentParser(description="Prints the timestamp of the "
19 "last commit in a git repository")
20 parser.add_argument("--directory", nargs='?',
21 help="Directory of the git repository", default=".")
22 parser.add_argument("--output", nargs='?',
23 help="Output file, or stdout if omitted")
24 args = parser.parse_args()
25
26 output_file = sys.stdout
27 if args.output:
28 output_file = open(args.output, 'w')
29
30 with output_file:
31 # Print without newline so GN can read it.
32 output_file.write(get_timestamp(args.directory))
33
34 if __name__ == '__main__':
35 sys.exit(main())
36
OLDNEW
« no previous file with comments | « mojo/public/tools/download_shell_binary.py ('k') | mojo/public/tools/gn/unzip.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698