diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 07:10:34 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 07:10:34 +0000 |
commit | 732a4eb324abf0d0f0c2bf539634a5e45ef5f56f (patch) | |
tree | b0522edde1d3c5356c95eb1ee2eae3e87befa1f3 /llvm_tools/git.py | |
parent | 2a058b7202958ba2d7dbd6fcd94269f22fc1bb8b (diff) | |
parent | 882a18888febb9cb0b9d6c6069498cbc4aa30f88 (diff) | |
download | toolchain-utils-732a4eb324abf0d0f0c2bf539634a5e45ef5f56f.tar.gz |
Snap for 8564071 from 882a18888febb9cb0b9d6c6069498cbc4aa30f88 to mainline-adbd-releaseaml_adb_331610000aml_adb_331314020aml_adb_331113120aml_adb_331011050aml_adb_331011040android13-mainline-adbd-release
Change-Id: I7d699ae80f7dde43c90d293678297cdf6a79b2bc
Diffstat (limited to 'llvm_tools/git.py')
-rwxr-xr-x | llvm_tools/git.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/llvm_tools/git.py b/llvm_tools/git.py index f38d5e72..22c7002a 100755 --- a/llvm_tools/git.py +++ b/llvm_tools/git.py @@ -65,14 +65,14 @@ def DeleteBranch(repo, branch): if not os.path.isdir(repo): raise ValueError('Invalid directory path provided: %s' % repo) - subprocess.check_output(['git', '-C', repo, 'checkout', 'cros/master']) + subprocess.check_output(['git', '-C', repo, 'checkout', 'cros/main']) subprocess.check_output(['git', '-C', repo, 'reset', 'HEAD', '--hard']) subprocess.check_output(['git', '-C', repo, 'branch', '-D', branch]) -def UploadChanges(repo, branch, commit_messages): +def UploadChanges(repo, branch, commit_messages, reviewers=None, cc=None): """Uploads the changes in the specifed branch of the given repo for review. Args: @@ -80,6 +80,8 @@ def UploadChanges(repo, branch, commit_messages): branch: The name of the branch to upload. commit_messages: A string of commit message(s) (i.e. '[message]' of the changes made. + reviewers: A list of reviewers to add to the CL. + cc: A list of contributors to CC about the CL. Returns: A nametuple that has two (key, value) pairs, where the first pair is the @@ -101,12 +103,24 @@ def UploadChanges(repo, branch, commit_messages): subprocess.check_output(['git', 'commit', '-F', f.name], cwd=repo) # Upload the changes for review. + git_args = [ + 'repo', + 'upload', + '--yes', + f'--reviewers={",".join(reviewers)}' if reviewers else '--ne', + '--no-verify', + f'--br={branch}', + ] + + if cc: + git_args.append(f'--cc={",".join(cc)}') + out = subprocess.check_output( - ['repo', 'upload', '--yes', '--ne', '--no-verify', - '--br=%s' % branch], + git_args, stderr=subprocess.STDOUT, cwd=repo, - encoding='utf-8') + encoding='utf-8', + ) print(out) |