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

Unified Diff: build/util/lastchange.py

Issue 1361203002: Omit commit position for Blink lastchange / version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/util/lastchange.py
diff --git a/build/util/lastchange.py b/build/util/lastchange.py
index 3f3ee4af47117c5d00143713217a27964eb226c6..ce1926afc4d5bd37141624af079a4e36dcd1036b 100755
--- a/build/util/lastchange.py
+++ b/build/util/lastchange.py
@@ -90,7 +90,7 @@ def RunGitCommand(directory, command):
return None
-def FetchGitRevision(directory):
+def FetchGitRevision(directory, hash_only):
"""
Fetch the Git hash for a given directory.
@@ -116,7 +116,7 @@ def FetchGitRevision(directory):
if line.startswith('Cr-Commit-Position:'):
pos = line.rsplit()[-1].strip()
break
- if not pos:
+ if hash_only or not pos:
return VersionInfo('git', hsh)
return VersionInfo('git', '%s-%s' % (hsh, pos))
@@ -166,7 +166,7 @@ def FetchGitSVNRevision(directory, svn_url_regex, go_deeper):
def FetchVersionInfo(default_lastchange, directory=None,
directory_regex_prior_to_src_url='chrome|blink|svn',
- go_deeper=False):
+ go_deeper=False, hash_only=False):
"""
Returns the last change (in the form of a branch, revision tuple),
from some appropriate revision control system.
@@ -176,7 +176,7 @@ def FetchVersionInfo(default_lastchange, directory=None,
version_info = (FetchSVNRevision(directory, svn_url_regex) or
FetchGitSVNRevision(directory, svn_url_regex, go_deeper) or
- FetchGitRevision(directory))
+ FetchGitRevision(directory, hash_only))
if not version_info:
if default_lastchange and os.path.exists(default_lastchange):
revision = open(default_lastchange, 'r').read().strip()
@@ -263,6 +263,9 @@ def main(argv=None):
parser.add_option("--git-svn-go-deeper", action='store_true',
help="In a Git-SVN repo, dig down to the last committed " +
"SVN change (historic behaviour).")
+ parser.add_option("--git-hash-only", action="store_true",
+ help="In a Git repo with commit positions, only report " +
+ "the hash.")
opts, args = parser.parse_args(argv[1:])
out_file = opts.output
@@ -283,7 +286,8 @@ def main(argv=None):
version_info = FetchVersionInfo(opts.default_lastchange,
directory=src_dir,
- go_deeper=opts.git_svn_go_deeper)
+ go_deeper=opts.git_svn_go_deeper,
+ hash_only=opts.git_hash_only)
if version_info.revision == None:
version_info.revision = '0'
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698