Commit 1abf4e4a authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

put change refs into a more defined place


don't mess with the remote ref string

Change-Id: I30890801a40fc66049e96534ec69c7fe60032085
Reviewed-by: default avatarRohan McGovern <rohan.mcgovern@nokia.com>
parent 02cf006e
No related merge requests found
Showing with 6 additions and 7 deletions
...@@ -82,9 +82,9 @@ sub printerr($) ...@@ -82,9 +82,9 @@ sub printerr($)
print STDERR $msg.".\n"; print STDERR $msg.".\n";
} }
sub process_commit($$$) sub process_commit($$$$)
{ {
my ($project, $ref, $rev) = @_; my ($number, $project, $ref, $rev) = @_;
if (defined $processed{$ref}) { if (defined $processed{$ref}) {
return; return;
...@@ -117,9 +117,7 @@ sub process_commit($$$) ...@@ -117,9 +117,7 @@ sub process_commit($$$)
chomp(@mainlines = `git config remote.origin.fetch`); chomp(@mainlines = `git config remote.origin.fetch`);
$skipfetch{$project} = 1; $skipfetch{$project} = 1;
} }
my $dref = $ref; if (system("git", "fetch", "-f", "origin", $ref.":refs/changes/".$number, @mainlines)) {
$dref =~ s,/[^/]+$,,;
if (system("git", "fetch", "-f", "origin", $ref.":".$dref, @mainlines)) {
printerr "GIT fetch of ".$ref." from ".$project." failed"; printerr "GIT fetch of ".$ref." from ".$project." failed";
return; return;
} }
...@@ -167,6 +165,7 @@ open STATUS, "-|", @gerrit, "query", "--format", "JSON", "--current-patch-set", ...@@ -167,6 +165,7 @@ open STATUS, "-|", @gerrit, "query", "--format", "JSON", "--current-patch-set",
REVIEW: while (<STATUS>) { REVIEW: while (<STATUS>) {
my $review = decode_json($_); my $review = decode_json($_);
defined($review) or die "cannot decode JSON string '".chomp($_)."'\n"; defined($review) or die "cannot decode JSON string '".chomp($_)."'\n";
my $number = $$review{'number'};
my $project = $$review{'project'}; my $project = $$review{'project'};
my $cps = $$review{'currentPatchSet'}; my $cps = $$review{'currentPatchSet'};
if (defined $cps) { if (defined $cps) {
...@@ -186,7 +185,7 @@ REVIEW: while (<STATUS>) { ...@@ -186,7 +185,7 @@ REVIEW: while (<STATUS>) {
} }
} }
} }
process_commit($project, $ref, $revision); process_commit($number, $project, $ref, $revision);
} }
} }
close STATUS; close STATUS;
...@@ -199,7 +198,7 @@ while (<UPDATES>) { ...@@ -199,7 +198,7 @@ while (<UPDATES>) {
if ($type eq 'patchset-created') { if ($type eq 'patchset-created') {
my $chg = $$update{'change'}; my $chg = $$update{'change'};
my $ps = $$update{'patchSet'}; my $ps = $$update{'patchSet'};
process_commit($$chg{'project'}, $$ps{'ref'}, $$ps{'revision'}); process_commit($$chg{'number'}, $$chg{'project'}, $$ps{'ref'}, $$ps{'revision'});
} elsif ($type eq 'ref-updated') { } elsif ($type eq 'ref-updated') {
my $rup = $$update{'refUpdate'}; my $rup = $$update{'refUpdate'};
delete $skipfetch{$$rup{'project'}}; delete $skipfetch{$$rup{'project'}};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment