diff options
author | Oswald Buddenhagen <oswald.buddenhagen@gmx.de> | 2019-10-13 17:21:39 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@gmx.de> | 2020-02-28 17:40:18 +0000 |
commit | 2518a5e7c6d9d175929dc79b870dc33b2bcba956 (patch) | |
tree | 9b6d23844c4b4266dcaa2c91e19a03bfe43765f4 /bin/git-gpush | |
parent | a3a05fe728179410a58e77a0adcc33f2daaad77c (diff) | |
download | qtrepotools-2518a5e7c6d9d175929dc79b870dc33b2bcba956.tar.gz |
gpush: do not try to redundantly add reviewers
this isn't very useful as such, but provides a foundation for later
functionality.
Change-Id: I58d7bd8fb21e6f77ac723a45eb30bb6cbe927825
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'bin/git-gpush')
-rwxr-xr-x | bin/git-gpush | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/bin/git-gpush b/bin/git-gpush index 681e19f..ba210ba 100755 --- a/bin/git-gpush +++ b/bin/git-gpush @@ -685,6 +685,31 @@ sub print_errors($) if ($need_force && !$force); } +sub prepare_meta($) +{ + my ($group) = @_; + + my (%invite_rvrs, %invite_ccs); + if (@reviewers || @CCs) { + foreach my $change (@{$$group{changes}}) { + my $ginfo = $$change{gerrit}; + my $rvrs = $ginfo ? $$ginfo{reviewers} : {}; + foreach my $rvr (@reviewers) { + if (($$rvrs{$rvr} // RVRTYPE_NONE) != RVRTYPE_REV) { + $invite_rvrs{$rvr} = 1; + } + } + foreach my $cc (@CCs) { + if (($$rvrs{$cc} // RVRTYPE_NONE) != RVRTYPE_CC) { + $invite_ccs{$cc} = 1; + } + } + } + } + $$group{add_rvrs} = [ keys %invite_rvrs ]; + $$group{add_ccs} = [ keys %invite_ccs ]; +} + sub push_changes($) { my ($group) = @_; @@ -692,10 +717,11 @@ sub push_changes($) my $from = $$group{changes}[-1]; my $tip = $$from{local}{id}; my $to = $$group{branch}; + my ($rvrs, $ccs) = ($$group{add_rvrs} // [], $$group{add_ccs} // []); my @push_options; - push @push_options, map { "r=$_" } @reviewers; - push @push_options, map { "cc=$_" } @CCs; + push @push_options, map { "r=$_" } @$rvrs; + push @push_options, map { "cc=$_" } @$ccs; my @gitcmd = ("git", "push"); push @gitcmd, '-v' if ($verbose); @@ -733,7 +759,9 @@ sub execute_pushing() # Only 2nd+ parents of local commits. map { @$_ > 1 ? @$_[1 .. $#$_] : () } map { $$_{local}{parents} } @$pushed_changes; - query_gerrit(\@queries); + my @args; + push @args, "--all-reviewers" if (@reviewers || @CCs); + query_gerrit(\@queries, \@args); } determine_remote_branch($group); if ($online) { @@ -749,6 +777,7 @@ sub execute_pushing() } else { print_errors($group); show_changes($group) if (!$quiet); + prepare_meta($group); if ($have_modified) { push_changes($group); } else { |