From 0c999fd71ad5b1bfeac0d9b37a4b443badd4cc17 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 15 May 2024 21:31:01 +0000 Subject: [PATCH] fail gracefully if git reparent-branch is called in cog Bug: 339231299 Change-Id: I395095bbdf4d097ff1ab236eb07cf308cef04799 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5540929 Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic Auto-Submit: Yiwei Zhang --- git_reparent_branch.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/git_reparent_branch.py b/git_reparent_branch.py index 3366a3ec3b..830f701769 100755 --- a/git_reparent_branch.py +++ b/git_reparent_branch.py @@ -13,12 +13,18 @@ from git_common import upstream, current_branch, run, tags, set_branch_config from git_common import get_or_create_merge_base, root, manual_merge_base from git_common import get_branch_tree, topo_iter +import gclient_utils import git_rebase_update import metrics @metrics.collector.collect_metrics('git reparent-branch') def main(args): + if gclient_utils.IsEnvCog(): + print( + 'reparent-branch command is not supported in non-git environment.', + file=sys.stderr) + return 1 root_ref = root() parser = argparse.ArgumentParser()