output actual CIPD package URL instead of 'None' when calling revinfo -a
Note: we are only evaluating cipd variables in the URL not the package string on the left hand side, as to not break any existing expected behaviour.
Bug:b/279097790
Change-Id: I0b6008254bd387584b9c0ee083c79bf5dc77fbc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4536475
Commit-Queue: Dan Le Febvre <dlf@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
diff --git a/gclient.py b/gclient.py
index 8ca899c..be074ae 100755
--- a/gclient.py
+++ b/gclient.py
@@ -538,6 +538,11 @@
return
url = None
scm = self.CreateSCM()
+ if scm.name == 'cipd':
+ revision = scm.revinfo(None, None, None)
+ package = self.GetExpandedPackageName()
+ url = '%s/p/%s/+/%s' % (scm.GetActualRemoteURL(None), package, revision)
+
if os.path.isdir(scm.checkout_path):
revision = scm.revinfo(None, None, None)
url = '%s@%s' % (gclient_utils.SplitUrlRevision(self.url)[0], revision)
@@ -2277,6 +2282,13 @@
"""Always 'cipd'."""
return 'cipd'
+ def GetExpandedPackageName(self):
+ """Return the CIPD package name with the variables evaluated."""
+ package = self._cipd_root.expand_package_name(self._package_name)
+ if package:
+ return package
+ return self._package_name
+
#override
def CreateSCM(self, out_cb=None):
"""Create a Wrapper instance suitable for handling this CIPD dependency."""