mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
fail gracefully if git new-branch is called in cog
Bug: 339231299 Change-Id: I21084c12815c82f7c0a90b5755de4d5551b6d94d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5540434 Auto-Submit: Yiwei Zhang <yiwzhang@google.com> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
@@ -9,6 +9,7 @@ Create new branch tracking origin HEAD by default.
|
|||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import gclient_utils
|
||||||
import git_common
|
import git_common
|
||||||
import subprocess2
|
import subprocess2
|
||||||
|
|
||||||
@@ -52,6 +53,10 @@ def create_new_branch(branch_name,
|
|||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
|
if gclient_utils.IsEnvCog():
|
||||||
|
print('new-branch command is not supported in non-git environment.',
|
||||||
|
file=sys.stderr)
|
||||||
|
return 1
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||||
description=__doc__,
|
description=__doc__,
|
||||||
|
|||||||
Reference in New Issue
Block a user