From 3534ec83dcf71a3ec3b3351c5ba4321bb0b5965c Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 24 Sep 2015 08:52:09 -0700 Subject: [PATCH] [Backport] Use the latest hash with a commit position as webkit version This will guarantee that a development build with a not yet commit HEAD will also get a valid devtools frontend from the servers BUG=535268 R=pfeldman@chromium.org,mnaganov@chromium.org,dpranke@chromium.org Review URL: https://codereview.chromium.org/1361393002 [necessary so that lastchange.py does not use the tip of the chromium-crosswalk tree when generating UPSTREAM.blink] --- build/util/lastchange.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build/util/lastchange.py b/build/util/lastchange.py index ce1926afc4d5b..c81e0bd52ecd5 100755 --- a/build/util/lastchange.py +++ b/build/util/lastchange.py @@ -100,7 +100,10 @@ def FetchGitRevision(directory, hash_only): A VersionInfo object or None on error. """ hsh = '' - proc = RunGitCommand(directory, ['rev-parse', 'HEAD']) + git_args = ['log', '-1', '--format=%H'] + if hash_only: + git_args.append('--grep=^Cr-Commit-Position:') + proc = RunGitCommand(directory, git_args) if proc: output = proc.communicate()[0].strip() if proc.returncode == 0 and output: @@ -108,7 +111,7 @@ def FetchGitRevision(directory, hash_only): if not hsh: return None pos = '' - proc = RunGitCommand(directory, ['cat-file', 'commit', 'HEAD']) + proc = RunGitCommand(directory, ['cat-file', 'commit', hsh]) if proc: output = proc.communicate()[0] if proc.returncode == 0 and output: @@ -264,8 +267,8 @@ def main(argv=None): 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.") + help="In a Git repo with commit positions, report only " + + "the hash of the latest commit with a position.") opts, args = parser.parse_args(argv[1:]) out_file = opts.output