gclient flatten: do not double-pin entries using a non-sha revision
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 <mmoss@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
diff --git a/gclient.py b/gclient.py
index 4d6db76..1872623 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1734,14 +1734,19 @@
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(