diff options
author | Mike Frysinger <vapier@google.com> | 2024-06-30 20:12:07 -0400 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-07-01 17:54:19 +0000 |
commit | 87f52f308c48c11a99cefcc308a0994abeb2a7ff (patch) | |
tree | 00f47a3ee2fa49753e562622c7f655788ad73bdd /subcmds/upload.py | |
parent | 562cea77580d5f217be73f21757c7d5b32d2d11f (diff) | |
download | git-repo-87f52f308c48c11a99cefcc308a0994abeb2a7ff.tar.gz |
upload: add a --topic option for setting topic explicitly
Let people specify the exact topic when uploading CLs. The existing
-t option only supports setting the topic to the current local branch.
Add a --topic-branch long option to the existing -t to align it a bit
better with --hashtag & --hashtag-branch.
Change-Id: I010abc4a7f3c685021cae776dd1e597c22b79135
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/431997
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/upload.py')
-rw-r--r-- | subcmds/upload.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index 5b8c1a20..8039a1cd 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -218,9 +218,14 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
218 | def _Options(self, p): | 218 | def _Options(self, p): |
219 | p.add_option( | 219 | p.add_option( |
220 | "-t", | 220 | "-t", |
221 | "--topic-branch", | ||
221 | dest="auto_topic", | 222 | dest="auto_topic", |
222 | action="store_true", | 223 | action="store_true", |
223 | help="send local branch name to Gerrit Code Review", | 224 | help="set the topic to the local branch name", |
225 | ) | ||
226 | p.add_option( | ||
227 | "--topic", | ||
228 | help="set topic for the change", | ||
224 | ) | 229 | ) |
225 | p.add_option( | 230 | p.add_option( |
226 | "--hashtag", | 231 | "--hashtag", |
@@ -551,9 +556,12 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
551 | 556 | ||
552 | # Check if topic branches should be sent to the server during | 557 | # Check if topic branches should be sent to the server during |
553 | # upload. | 558 | # upload. |
554 | if opt.auto_topic is not True: | 559 | if opt.topic is None: |
555 | key = "review.%s.uploadtopic" % branch.project.remote.review | 560 | if opt.auto_topic is not True: |
556 | opt.auto_topic = branch.project.config.GetBoolean(key) | 561 | key = "review.%s.uploadtopic" % branch.project.remote.review |
562 | opt.auto_topic = branch.project.config.GetBoolean(key) | ||
563 | if opt.auto_topic: | ||
564 | opt.topic = branch.name | ||
557 | 565 | ||
558 | def _ExpandCommaList(value): | 566 | def _ExpandCommaList(value): |
559 | """Split |value| up into comma delimited entries.""" | 567 | """Split |value| up into comma delimited entries.""" |
@@ -620,7 +628,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
620 | branch.UploadForReview( | 628 | branch.UploadForReview( |
621 | people, | 629 | people, |
622 | dryrun=opt.dryrun, | 630 | dryrun=opt.dryrun, |
623 | auto_topic=opt.auto_topic, | 631 | topic=opt.topic, |
624 | hashtags=hashtags, | 632 | hashtags=hashtags, |
625 | labels=labels, | 633 | labels=labels, |
626 | private=opt.private, | 634 | private=opt.private, |