From aa89e07e156b9bf674a416cc9c1847a7ad7cb6eb Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Fri, 7 Jun 2024 18:13:39 +0000 Subject: [PATCH] fail if fetch command is called in Cog Bug: 345486495 Change-Id: I858a4041b54049cc52cf1a15f0aed461f3ddf985 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5606279 Auto-Submit: Yiwei Zhang Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic --- fetch.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fetch.py b/fetch.py index 2c860429f..99ba59d16 100755 --- a/fetch.py +++ b/fetch.py @@ -24,6 +24,7 @@ import shlex import subprocess import sys +import gclient_utils import git_common from distutils import spawn @@ -270,6 +271,12 @@ def run(options, spec, root): method (checkout type, repository url, etc.). root: The directory into which the repo expects to be checkout out. """ + if gclient_utils.IsEnvCog(): + print( + 'Your current directory appears to be in a Cog workspace.' + '"fetch" command is not supported in this environment.', + file=sys.stderr) + return 1 assert 'type' in spec checkout_type = spec['type'] checkout_spec = spec['%s_spec' % checkout_type]