7 my $filterargs = "HEAD^..";
8 my $list_reviewers = 0;
17 if (/^[a-z]+$/ || /^\@\w(?:[-\w]*\w)?$/) {
18 $args .= "--reviewer=$_ ";
19 } elsif (/^--reviewer=(.+)$/) {
20 $args .= "--reviewer=$1 ";
21 } elsif (/^--rmreviewers$/) {
22 $args .= "--rmreviewers ";
23 } elsif (/^--trivial$/) {
24 $args .= "--trivial ";
27 } elsif (/^--tools$/) {
29 } elsif (/^--verbose$/) {
30 $args .= "--verbose ";
31 } elsif (/^--noself$/) {
33 } elsif (/^--myemail=(.+)$/) {
35 } elsif (/^--nopr$/) {
37 } elsif (/^--prnum=(.+)$/) {
38 $args .= "--prnum=$1 ";
40 } elsif (/^--commit=(.+)$/) {
41 $args .= "--commit=$1 ";
42 } elsif (/^-(\d+)$/) {
43 $filterargs = "HEAD~$1..";
44 } elsif (/^--list$/) {
47 } elsif (/^--help$/ || /^-h$/) {
55 if ($list_reviewers) {
56 system("gitaddrev --list");
64 die "Need either --prnum or --nopr flag" unless $haveprnum;
67 if (!defined $my_email) {
68 $my_email = `git config --get user.email`;
71 $args .= "--myemail=$my_email ";
74 system("git filter-branch -f --tag-name-filter cat --msg-filter \"gitaddrev $args\" $filterargs");
80 option style arguments:
82 --help Print this help and exit
83 --list List the known reviewers and exit (discards all other
85 --verbose Be a bit more verbose
86 --reviewer=<reviewer> A reviewer to be added on a Reviewed-by: line
87 --rmreviewers Remove all existing Reviewed-by: lines before adding
89 --commit=<id> Only apply to commit <id>
90 --myemail=<email> Set email address. Defaults to the result from
91 git configuration setting user.email.
92 --nopr Do not requre a PR number.
93 --prnum=NNN Add a reference to GitHub pull request NNN
94 -<n> Change the last <n> commits. Defaults to 1.
96 non-option style arguments can be:
98 a string of lower case letters, denoting a reviewer name.
100 a string starting with \@, denoting a reviewer's github ID.
102 anything else will be used as a commit range. If no commit range is given,
105 Examples (all meaning the same thing):
107 addrev -2 steve levitte
108 addrev steve \@levitte HEAD^^..
109 addrev --reviewer=steve --reviewer=levitte\@openssl.org -2