From 39300ba2a0b249cfad2531917410c8bbeff07e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Hajdan=2C=20Jr?= Date: Fri, 11 Aug 2017 16:52:38 +0200 Subject: [PATCH] gclient flatten: do not double-pin entries using a non-sha revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For example: # buildspec -> tools_internal_DEPS -> build/third_party/python-rsa "build/third_party/python-rsa": { "url": "{git_url}/external/github.com/sybrenstuvel/python-rsa.git@version-3.1.4", }, Bug: 570091 Change-Id: I5fd444908c06fbd03bdaf0715401c1dbd9fbe89f Reviewed-on: https://chromium-review.googlesource.com/611988 Reviewed-by: Michael Moss Commit-Queue: Paweł Hajdan Jr. --- gclient.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gclient.py b/gclient.py index 4d6db765a..1872623f0 100755 --- a/gclient.py +++ b/gclient.py @@ -1734,14 +1734,19 @@ class Flattener(object): for dep in self._deps.itervalues(): if dep.parsed_url is None: continue - url, revision = gclient_utils.SplitUrlRevision(dep.parsed_url) - if revision and gclient_utils.IsGitSha(revision): - continue + scm = gclient_scm.CreateSCM( dep.parsed_url, self._client.root_dir, dep.name, dep.outbuf) revinfo = scm.revinfo(self._client._options, [], None) + + # Make sure the revision is always fully specified (a hash), + # as opposed to refs or tags which might change. + url, revision = gclient_utils.SplitUrlRevision(dep.parsed_url) + if revision and gclient_utils.IsGitSha(revision): + continue dep._parsed_url = dep._url = '%s@%s' % (url, revinfo) - dep._raw_url = '%s@%s' % (dep._raw_url, revinfo) + raw_url, _ = gclient_utils.SplitUrlRevision(dep._raw_url) + dep._raw_url = '%s@%s' % (raw_url, revinfo) self._deps_string = '\n'.join( _GNSettingsToLines(