Commit 39300ba2 authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr Committed by Commit Bot

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/611988Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
Commit-Queue: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
parent 59c6ed1c
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment