diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/upload.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index 91bec6f8..633ddc81 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
| @@ -130,6 +130,12 @@ is set to "true" then repo will assume you always want the equivalent | |||
| 130 | of the -t option to the repo command. If unset or set to "false" then | 130 | of the -t option to the repo command. If unset or set to "false" then |
| 131 | repo will make use of only the command line option. | 131 | repo will make use of only the command line option. |
| 132 | 132 | ||
| 133 | review.URL.uploadhashtags: | ||
| 134 | |||
| 135 | To add hashtags whenever uploading a commit, you can set a per-project | ||
| 136 | or global Git option to do so. The value of review.URL.uploadhashtags | ||
| 137 | will be used as comma delimited hashtags like the --hashtags option. | ||
| 138 | |||
| 133 | # References | 139 | # References |
| 134 | 140 | ||
| 135 | Gerrit Code Review: https://www.gerritcodereview.com/ | 141 | Gerrit Code Review: https://www.gerritcodereview.com/ |
| @@ -140,6 +146,9 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
| 140 | p.add_option('-t', | 146 | p.add_option('-t', |
| 141 | dest='auto_topic', action='store_true', | 147 | dest='auto_topic', action='store_true', |
| 142 | help='Send local branch name to Gerrit Code Review') | 148 | help='Send local branch name to Gerrit Code Review') |
| 149 | p.add_option('--hashtag', '--ht', | ||
| 150 | dest='hashtags', action='append', default=[], | ||
| 151 | help='Add hashtags (comma delimited) to the review.') | ||
| 143 | p.add_option('--re', '--reviewers', | 152 | p.add_option('--re', '--reviewers', |
| 144 | type='string', action='append', dest='reviewers', | 153 | type='string', action='append', dest='reviewers', |
| 145 | help='Request reviews from these people.') | 154 | help='Request reviews from these people.') |
| @@ -384,6 +393,20 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
| 384 | key = 'review.%s.uploadtopic' % branch.project.remote.review | 393 | key = 'review.%s.uploadtopic' % branch.project.remote.review |
| 385 | opt.auto_topic = branch.project.config.GetBoolean(key) | 394 | opt.auto_topic = branch.project.config.GetBoolean(key) |
| 386 | 395 | ||
| 396 | # Check if hashtags should be included. | ||
| 397 | def _ExpandHashtag(value): | ||
| 398 | """Split |value| up into comma delimited tags.""" | ||
| 399 | if not value: | ||
| 400 | return | ||
| 401 | for tag in value.split(','): | ||
| 402 | tag = tag.strip() | ||
| 403 | if tag: | ||
| 404 | yield tag | ||
| 405 | key = 'review.%s.uploadhashtags' % branch.project.remote.review | ||
| 406 | hashtags = set(_ExpandHashtag(branch.project.config.GetString(key))) | ||
| 407 | for tag in opt.hashtags: | ||
| 408 | hashtags.update(_ExpandHashtag(tag)) | ||
| 409 | |||
| 387 | destination = opt.dest_branch or branch.project.dest_branch | 410 | destination = opt.dest_branch or branch.project.dest_branch |
| 388 | 411 | ||
| 389 | # Make sure our local branch is not setup to track a different remote branch | 412 | # Make sure our local branch is not setup to track a different remote branch |
| @@ -401,6 +424,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
| 401 | 424 | ||
| 402 | branch.UploadForReview(people, | 425 | branch.UploadForReview(people, |
| 403 | auto_topic=opt.auto_topic, | 426 | auto_topic=opt.auto_topic, |
| 427 | hashtags=hashtags, | ||
| 404 | draft=opt.draft, | 428 | draft=opt.draft, |
| 405 | private=opt.private, | 429 | private=opt.private, |
| 406 | notify=None if opt.notify else 'NONE', | 430 | notify=None if opt.notify else 'NONE', |
