Просмотр исходного кода

error if git cache commands are called in cog env.

Bug: 339231299
Change-Id: I0baa6ba9836b0026fb5b5c27b17a72c6e4d7ecde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5536289
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Yiwei Zhang 1 год назад
Родитель
Сommit
6a7597cf9a
1 измененных файлов с 17 добавлено и 0 удалено
  1. 17 0
      git_cache.py

+ 17 - 0
git_cache.py

@@ -732,6 +732,11 @@ def CMDupdate_bootstrap(parser, args):
               file=sys.stderr)
         return 1
 
+    if gclient_utils.IsEnvCog():
+        print('updating bootstrap is not supported in non-git environment.',
+              file=sys.stderr)
+        return 1
+
     parser.add_option('--skip-populate',
                       action='store_true',
                       help='Skips "populate" step if mirror already exists.')
@@ -763,6 +768,11 @@ def CMDupdate_bootstrap(parser, args):
 @metrics.collector.collect_metrics('git cache populate')
 def CMDpopulate(parser, args):
     """Ensure that the cache has all up-to-date objects for the given repo."""
+    if gclient_utils.IsEnvCog():
+        print('populating cache is not supported in non-git environment.',
+              file=sys.stderr)
+        return 1
+
     parser.add_option('--depth',
                       type='int',
                       help='Only cache DEPTH commits of history')
@@ -826,6 +836,13 @@ def CMDpopulate(parser, args):
 @metrics.collector.collect_metrics('git cache fetch')
 def CMDfetch(parser, args):
     """Update mirror, and fetch in cwd."""
+    if gclient_utils.IsEnvCog():
+        print(
+            'fetching new commits into cache is not supported in non-git '
+            'environment.',
+            file=sys.stderr)
+        return 1
+
     parser.add_option('--all', action='store_true', help='Fetch all remotes')
     parser.add_option('--no_bootstrap',
                       '--no-bootstrap',