summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 19:19:21 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 19:19:21 +0000
commit9e63fded0cfe8c190294f5f26137afda39cbf3f2 (patch)
treeb99524d7dbddfd89d9a883d7ecd99e41cb391bc6 /build
parent75adb07d770e1ff1c5147d835a818d7afb7fb94b (diff)
downloadchromium_src-9e63fded0cfe8c190294f5f26137afda39cbf3f2.zip
chromium_src-9e63fded0cfe8c190294f5f26137afda39cbf3f2.tar.gz
chromium_src-9e63fded0cfe8c190294f5f26137afda39cbf3f2.tar.bz2
lastchange: add a flag to only print the svn revision number
This allows me to change one of the callers to not parse the "REVISION=1234" output, which will allow me to change that output in a future change. BUG=41264 Review URL: http://codereview.chromium.org/6265021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72170 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rwxr-xr-xbuild/util/lastchange.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/build/util/lastchange.py b/build/util/lastchange.py
index ff518fc..1846bab 100755
--- a/build/util/lastchange.py
+++ b/build/util/lastchange.py
@@ -71,11 +71,13 @@ def main(argv=None):
if argv is None:
argv = sys.argv
- parser = optparse.OptionParser(usage="lastchange.py [-h] [[-o] FILE]")
+ parser = optparse.OptionParser(usage="lastchange.py [options]")
parser.add_option("-d", "--default-lastchange", metavar="FILE",
help="default last change input FILE")
parser.add_option("-o", "--output", metavar="FILE",
help="write last change to FILE")
+ parser.add_option("--revision-only", action='store_true',
+ help="just print the SVN revision number")
opts, args = parser.parse_args(argv[1:])
out_file = opts.output
@@ -90,12 +92,14 @@ def main(argv=None):
change = FetchChange(opts.default_lastchange)
- contents = "LASTCHANGE=%s\n" % change
-
- if out_file:
- WriteIfChanged(out_file, contents)
+ if opts.revision_only:
+ print change
else:
- sys.stdout.write(contents)
+ contents = "LASTCHANGE=%s\n" % change
+ if out_file:
+ WriteIfChanged(out_file, contents)
+ else:
+ sys.stdout.write(contents)
return 0