upload: add a --hashtag-branch option akin to -t

This will automatically add the current local branch name as a hashtag.

Bug: https://crbug.com/gerrit/10477
Change-Id: I888f8be8419c801f2d98b7a2ad2486799e94f32c
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255893
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2020-02-19 03:00:26 -05:00
parent 19ec797f81
commit 7ff80afdf6

View File

@ -149,6 +149,9 @@ Gerrit Code Review: https://www.gerritcodereview.com/
p.add_option('--hashtag', '--ht',
dest='hashtags', action='append', default=[],
help='Add hashtags (comma delimited) to the review.')
p.add_option('--hashtag-branch', '--htb',
action='store_true',
help='Add local branch name as a hashtag.')
p.add_option('--re', '--reviewers',
type='string', action='append', dest='reviewers',
help='Request reviews from these people.')
@ -420,6 +423,8 @@ Gerrit Code Review: https://www.gerritcodereview.com/
hashtags = set(_ExpandHashtag(branch.project.config.GetString(key)))
for tag in opt.hashtags:
hashtags.update(_ExpandHashtag(tag))
if opt.hashtag_branch:
hashtags.add(branch.name)
destination = opt.dest_branch or branch.project.dest_branch