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>
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 856c7fb..ef6d024 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -149,6 +149,9 @@
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 @@
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