From 60997ea745965c9dfc9edb459d53d9c841304a54 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 15 May 2024 21:25:38 +0000 Subject: [PATCH] fail gracefully if git nav-downstream is called in cog Bug: 339231299 Change-Id: If4d5dcc0ee0606acd8b539d19b29106f5152bba3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5540889 Commit-Queue: Josip Sokcevic Auto-Submit: Yiwei Zhang Reviewed-by: Josip Sokcevic --- git_nav_downstream.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git_nav_downstream.py b/git_nav_downstream.py index 7834d8a77..17dc31644 100755 --- a/git_nav_downstream.py +++ b/git_nav_downstream.py @@ -11,13 +11,18 @@ which branch. import argparse import sys -import gclient_utils from git_common import current_branch, branches, upstream, run, hash_one + +import gclient_utils import metrics @metrics.collector.collect_metrics('git nav-downstream') def main(args): + if gclient_utils.IsEnvCog(): + print('nav-downstream command is not supported in non-git environment.', + file=sys.stderr) + return 1 parser = argparse.ArgumentParser() parser.add_argument('--pick', help=('The number to pick if this command would '