The branch master has been updated
via 718bcaec77e8ac62f5d607e405a29c79af23f758 (commit)
via f3c270f43032e296a95868ba2309c37f84baf162 (commit)
via fd919bab0b95f3225553af616babec0642a9c0a6 (commit)
via 9a50378f356e619c985beb80675a37f6c83d94f9 (commit)
via 0da1a9b3fce88f56e2c0ec07d2237f2f68e53ac1 (commit)
via ded000860e43844ced47214535ab3e15b2effd74 (commit)
via 064fa8b5219684a0c26824fe80e1473cd7a8e895 (commit)
from 04003d05734dcd23f7c4a4e505ee7a222ceb8457 (commit)
- Log -----------------------------------------------------------------
commit 718bcaec77e8ac62f5d607e405a29c79af23f758
Author: Richard Levitte <[email protected]>
Date: Sun Jun 25 07:24:29 2017 +0200
Enhance addrev / gitaddrev documentation
commit f3c270f43032e296a95868ba2309c37f84baf162
Author: Richard Levitte <[email protected]>
Date: Sun Jun 25 07:23:37 2017 +0200
gitaddrev: list github identities correctly
commit fd919bab0b95f3225553af616babec0642a9c0a6
Author: Richard Levitte <[email protected]>
Date: Sun Jun 25 07:22:59 2017 +0200
addrev, gitaddrev: handle github ids with distinct syntax
github identities should be given with a prefixing @
commit 9a50378f356e619c985beb80675a37f6c83d94f9
Author: Richard Levitte <[email protected]>
Date: Sun Jun 25 07:17:21 2017 +0200
OpenSSL-Query: add request tests with tagged identities
commit 0da1a9b3fce88f56e2c0ec07d2237f2f68e53ac1
Author: Richard Levitte <[email protected]>
Date: Sun Jun 25 07:17:00 2017 +0200
OpenSSL-Query: handle requests with tagged identities
commit ded000860e43844ced47214535ab3e15b2effd74
Author: Richard Levitte <[email protected]>
Date: Sun Jun 25 07:16:28 2017 +0200
QueryApp: add request tests with tagged identities
commit 064fa8b5219684a0c26824fe80e1473cd7a8e895
Author: Richard Levitte <[email protected]>
Date: Sun Jun 25 07:15:58 2017 +0200
QueryApp: handle requests with tagged identities
-----------------------------------------------------------------------
Summary of changes:
OpenSSL-Query/lib/OpenSSL/Query/PersonREST.pm | 16 ++++++++---
OpenSSL-Query/t/query.t | 28 ++++++++++++++++++-
QueryApp/bin/query.psgi | 18 +++++++++----
QueryApp/t/query.t | 34 ++++++++++++++++++++++-
QueryApp/t/query_data/pdb.yaml | 4 +--
QueryApp/t/query_direct.t | 28 ++++++++++++++++++-
review-tools/README | 39 ++++++++-------------------
review-tools/addrev | 11 +++++---
review-tools/gitaddrev | 24 ++++++++++-------
9 files changed, 147 insertions(+), 55 deletions(-)
diff --git a/OpenSSL-Query/lib/OpenSSL/Query/PersonREST.pm
b/OpenSSL-Query/lib/OpenSSL/Query/PersonREST.pm
index a98a627..0b9db66 100644
--- a/OpenSSL-Query/lib/OpenSSL/Query/PersonREST.pm
+++ b/OpenSSL-Query/lib/OpenSSL/Query/PersonREST.pm
@@ -41,9 +41,19 @@ sub list_people {
return @$decoded;
}
+sub _id_encode {
+ my $id = shift;
+
+ return $id if ref($id) eq "";
+ croak "Malformed input ID" if ref($id) ne "HASH" || scalar keys %$id != 1;
+
+ my $tag = (keys %$id)[0];
+ return $tag . ':' . $id->{$tag};
+}
+
sub find_person {
my $self = shift;
- my $id = shift;
+ my $id = _id_encode(shift);
my $ua = $self->_personhandler;
my $json = $ua->get($self->base_url . '/0/Person/'
@@ -58,7 +68,7 @@ sub find_person {
sub find_person_tag {
my $self = shift;
- my $id = shift;
+ my $id = _id_encode(shift);
my $tag = shift;
my $ua = $self->_personhandler;
@@ -77,7 +87,7 @@ sub find_person_tag {
sub is_member_of {
my $self = shift;
- my $id = shift;
+ my $id = _id_encode(shift);
my $group = shift;
my $ua = $self->_personhandler;
diff --git a/OpenSSL-Query/t/query.t b/OpenSSL-Query/t/query.t
index f167a66..5cb7c25 100644
--- a/OpenSSL-Query/t/query.t
+++ b/OpenSSL-Query/t/query.t
@@ -11,7 +11,7 @@ use Test::More;
use OpenSSL::Query::REST;
use Data::Dumper;
-plan tests => 12;
+plan tests => 15;
SKIP: {
my $query;
@@ -42,6 +42,18 @@ SKIP: {
note( Dumper( { %res2 } ) );
};
+ subtest 'Request of person data for Ray Bradbury as full name' => sub {
+ plan tests => 2;
+
+ my $res1 = $query->find_person( { fullname => 'Ray Bradbury' } );
+ ok( $res1, 'Ray Bradbury is present' );
+ note( $res1 );
+
+ my %res2 = $query->find_person( 'Ray Bradbury' );
+ ok(scalar keys %res2 > 1, "Got Ray Bradbury's data" );
+ note( Dumper( { %res2 } ) );
+ };
+
subtest 'Request of membership in specific group for Ray Bradbury' => sub {
plan tests => 1;
my $res = $query->is_member_of( 'Ray Bradbury', 'scifi' );
@@ -49,6 +61,13 @@ SKIP: {
note( $res );
};
+ subtest 'Request of membership in specific group for Ray Bradbury as full
name' => sub {
+ plan tests => 1;
+ my $res = $query->is_member_of( { fullname => 'Ray Bradbury' }, 'scifi' );
+ ok( $res, "Ray Bradbury is member of scifi since ".( $res ? $res :
"(unknown)" ) );
+ note( $res );
+ };
+
subtest 'Request of "author" tag value for Ray Bradbury' => sub {
plan tests => 1;
my $res = $query->find_person_tag( 'Ray Bradbury', 'author' );
@@ -56,6 +75,13 @@ SKIP: {
note( Dumper $res );
};
+ subtest 'Request of "author" tag value for Ray Bradbury as full name' => sub
{
+ plan tests => 1;
+ my $res = $query->find_person_tag( { fullname => 'Ray Bradbury' },
'author' );
+ ok( $res, "The 'author' tag for Ray Bradbury is ".( $res ? $res :
"(unknown)" ) );
+ note( Dumper $res );
+ };
+
subtest 'Request of CLA status for Ray Bradbury' => sub {
plan tests => 1;
my $res = $query->has_cla( '[email protected]' );
diff --git a/QueryApp/bin/query.psgi b/QueryApp/bin/query.psgi
index d6c0e56..ec9a994 100644
--- a/QueryApp/bin/query.psgi
+++ b/QueryApp/bin/query.psgi
@@ -64,6 +64,14 @@ set bureau => '/var/cache/openssl/checkouts/bureau';
prefix '/0';
+sub name_decode {
+ my $name = shift;
+ if ($name =~ m|^([^:]+):(.+)$|) {
+ return { $1 => $2 };
+ }
+ return $name;
+}
+
get '/People' => sub {
my $query = OpenSSL::Query->new(bureau => config->{bureau});
my @response = $query->list_people();
@@ -74,7 +82,7 @@ get '/People' => sub {
get '/Person/:name' => sub {
my $query = OpenSSL::Query->new(bureau => config->{bureau});
- my $name = uri_decode(param('name'));
+ my $name = name_decode(uri_decode(param('name')));
my %response = $query->find_person($name);
return { %response } if %response;
@@ -83,7 +91,7 @@ get '/Person/:name' => sub {
get '/Person/:name/Membership' => sub {
my $query = OpenSSL::Query->new(bureau => config->{bureau}, REST => 0);
- my $name = uri_decode(param('name'));
+ my $name = name_decode(uri_decode(param('name')));
my %response = $query->find_person($name);
return $response{memberof} if %response;
@@ -92,7 +100,7 @@ get '/Person/:name/Membership' => sub {
get '/Person/:name/IsMemberOf/:group' => sub {
my $query = OpenSSL::Query->new(bureau => config->{bureau}, REST => 0);
- my $name = uri_decode(param('name'));
+ my $name = name_decode(uri_decode(param('name')));
my $group = uri_decode(param('group'));
my $response = $query->is_member_of($name, $group);
@@ -102,7 +110,7 @@ get '/Person/:name/IsMemberOf/:group' => sub {
get '/Person/:name/ValueOfTag/:tag' => sub {
my $query = OpenSSL::Query->new(bureau => config->{bureau}, REST => 0);
- my $name = uri_decode(param('name'));
+ my $name = name_decode(uri_decode(param('name')));
my $tag = uri_decode(param('tag'));
my $response = $query->find_person_tag($name, $tag);
@@ -112,7 +120,7 @@ get '/Person/:name/ValueOfTag/:tag' => sub {
get '/Person/:name/HasCLA' => sub {
my $query = OpenSSL::Query->new(bureau => config->{bureau}, REST => 0);
- my $name = uri_decode(param('name'));
+ my $name = name_decode(uri_decode(param('name')));
my %person = $query->find_person($name);
my @response = ();
diff --git a/QueryApp/t/query.t b/QueryApp/t/query.t
index 1f0d3d3..c570707 100644
--- a/QueryApp/t/query.t
+++ b/QueryApp/t/query.t
@@ -7,7 +7,7 @@ BEGIN { $ENV{DANCER_APPHANDLER} = 'PSGI';}
use strict;
use warnings;
-use Test::More tests => 15;
+use Test::More tests => 19;
use Plack::Test;
use Plack::Util;
use HTTP::Request::Common;
@@ -53,6 +53,14 @@ subtest 'Request of person data for Ray Bradbury' => sub {
is( $res->code, 200, 'We have content' );
};
+subtest 'Request of person data for Ray Bradbury as full name' => sub {
+ my $res = $test->request( GET '/0/Person/fullname:Ray Bradbury' );
+ plan tests => 2;
+ ok( $res->is_success, 'Successful request' );
+ note( $res->content );
+ is( $res->code, 200, 'We have content' );
+};
+
subtest 'Request of membership for Ray Bradbury' => sub {
my $res = $test->request( GET '/0/Person/Ray Bradbury/Membership' );
plan tests => 2;
@@ -61,6 +69,14 @@ subtest 'Request of membership for Ray Bradbury' => sub {
is( $res->code, 200, 'We have content' );
};
+subtest 'Request of membership for Ray Bradbury as fullname' => sub {
+ my $res = $test->request( GET '/0/Person/fullname:Ray Bradbury/Membership' );
+ plan tests => 2;
+ ok( $res->is_success, 'Successful request' );
+ note( $res->content );
+ is( $res->code, 200, 'We have content' );
+};
+
subtest 'Request of membership in specific group for Ray Bradbury' => sub {
my $res = $test->request( GET '/0/Person/Ray Bradbury/IsMemberOf/scifi' );
plan tests => 2;
@@ -69,6 +85,14 @@ subtest 'Request of membership in specific group for Ray
Bradbury' => sub {
is( $res->code, 200, 'We have content' );
};
+subtest 'Request of membership in specific group for Ray Bradbury as fullname'
=> sub {
+ my $res = $test->request( GET '/0/Person/fullname:Ray
Bradbury/IsMemberOf/scifi' );
+ plan tests => 2;
+ ok( $res->is_success, 'Successful request' );
+ note( $res->content );
+ is( $res->code, 200, 'We have content' );
+};
+
subtest 'Request of "author" tag value for Ray Bradbury' => sub {
my $res = $test->request( GET '/0/Person/Ray Bradbury/ValueOfTag/author' );
plan tests => 2;
@@ -77,6 +101,14 @@ subtest 'Request of "author" tag value for Ray Bradbury' =>
sub {
is( $res->code, 200, 'We have content' );
};
+subtest 'Request of "author" tag value for Ray Bradbury as fullname' => sub {
+ my $res = $test->request( GET '/0/Person/fullname:Ray
Bradbury/ValueOfTag/author' );
+ plan tests => 2;
+ ok( $res->is_success, 'Successful request' );
+ note( $res->content );
+ is( $res->code, 200, 'We have content' );
+};
+
subtest 'Request of CLA status for Ray Bradbury' => sub {
my $res = $test->request( GET '/0/HasCLA/[email protected]' );
plan tests => 2;
diff --git a/QueryApp/t/query_data/pdb.yaml b/QueryApp/t/query_data/pdb.yaml
index 2dc03a0..9be3211 100644
--- a/QueryApp/t/query_data/pdb.yaml
+++ b/QueryApp/t/query_data/pdb.yaml
@@ -1,6 +1,6 @@
-
ids:
- - Ray Bradbury
+ - fullname: Ray Bradbury
- Ray
- [email protected]
- Burn paper burn
@@ -12,7 +12,7 @@
-
ids:
- - Selma Lagerlöf
+ - fullname: Selma Lagerlöf
- Selma
memberof:
writers: [ 1891, 1940 ]
diff --git a/QueryApp/t/query_direct.t b/QueryApp/t/query_direct.t
index e7d8ac4..2687fd6 100644
--- a/QueryApp/t/query_direct.t
+++ b/QueryApp/t/query_direct.t
@@ -7,7 +7,7 @@ BEGIN { $ENV{DANCER_APPHANDLER} = 'PSGI';}
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More tests => 14;
use Data::Dumper;
use FindBin;
@@ -41,6 +41,18 @@ subtest 'Request of person data for Ray Bradbury' => sub {
note( Dumper( { %res2 } ) );
};
+subtest 'Request of person data for Ray Bradbury as full name' => sub {
+ plan tests => 2;
+
+ my $res1 = $query->find_person( { fullname => 'Ray Bradbury' } );
+ ok( $res1, 'Ray Bradbury is present' );
+ note( $res1 );
+
+ my %res2 = $query->find_person( 'Ray Bradbury' );
+ ok(scalar keys %res2 > 1, "Got Ray Bradbury's data" );
+ note( Dumper( { %res2 } ) );
+};
+
subtest 'Request of membership in specific group for Ray Bradbury' => sub {
plan tests => 1;
my $res = $query->is_member_of( 'Ray Bradbury', 'scifi' );
@@ -48,6 +60,13 @@ subtest 'Request of membership in specific group for Ray
Bradbury' => sub {
note( $res );
};
+subtest 'Request of membership in specific group for Ray Bradbury as fullname'
=> sub {
+ plan tests => 1;
+ my $res = $query->is_member_of( { fullname => 'Ray Bradbury' }, 'scifi' );
+ ok( $res, "Ray Bradbury is member of scifi since ".( $res ? $res :
"(unknown)" ) );
+ note( $res );
+};
+
subtest 'Request of "author" tag value for Ray Bradbury' => sub {
plan tests => 1;
my $res = $query->find_person_tag( 'Ray Bradbury', 'author' );
@@ -55,6 +74,13 @@ subtest 'Request of "author" tag value for Ray Bradbury' =>
sub {
note( Dumper $res );
};
+subtest 'Request of "author" tag value for Ray Bradbury as full name' => sub {
+ plan tests => 1;
+ my $res = $query->find_person_tag( { fullname => 'Ray Bradbury' }, 'author'
);
+ ok( $res, "The 'author' tag for Ray Bradbury is ".( $res ? $res :
"(unknown)" ) );
+ note( Dumper $res );
+};
+
subtest 'Request of CLA status for Ray Bradbury' => sub {
plan tests => 1;
my $res = $query->has_cla( '[email protected]' );
diff --git a/review-tools/README b/review-tools/README
index c2b2570..e601cc6 100644
--- a/review-tools/README
+++ b/review-tools/README
@@ -21,46 +21,29 @@ The scripts
addrev
------
-addrev is a simple pair of scripts to add or edit reviewers to commits.
+addrev and gitaddrev is a simple pair of scripts to add or edit reviewers to
+commits.
To use add the scripts gitaddrev and addrev to your PATH.
-Usage is
+Run 'addrev --help' for usage.
- addrev <arguments>
-
-<arguments> can be one of:
-
---reviewer=<name> add reviewer <name> to commit range: can be used more than
-once.
-
---commit=<id> only apply if commit matches <id>: can be used more than once
-
---rmreviewers remove all reviewers from commit range: useful if you screwed
-up.
-
--<number> change the last <number> commits if not present assumes the last
-commit only.
-
---trivial add the header "CLA: trivial" to the commits
-
-Any lower case string is assumed to be a reviewer name.
-
-Anything not matching the above is take to be a commit range.
-
-If a reviewer already exists in the log message it is deleted before it is
-added to the end of the log: this ensures a reviewer can only appear once
-in a commit.
+If a reviewer already exists in the log message, it isn't added again.
If the commiter is not the author of the commit then they are added
automatically as a reviewer.
+Reviewer names can be given as simple known lower case names, or as github
+IDs prefixed with a @, or known email addresses if given with --reviewer.
+
+Run 'addrev --list' to ge a list of known reviewer names.
+
Examples:
addrev steve
addrev -2 steve
- addrev -2 steve rich
- addrev -2 --reviewer=steve --reviewer=rich
+ addrev -2 steve @richsalz
+ addrev -2 --reviewer=steve [email protected]
gitlabutil
----------
diff --git a/review-tools/addrev b/review-tools/addrev
index b3f5531..6b3d64a 100755
--- a/review-tools/addrev
+++ b/review-tools/addrev
@@ -13,7 +13,7 @@ my $trivial = 0;
my $my_email;
foreach (@ARGV) {
- if (/^[a-z][-a-z]*$/) {
+ if (/^[a-z]+$/ || /^\@(?:\w|\w-\w)+$/) {
$args .= "--reviewer=$_ ";
} elsif (/^--reviewer=(.+)$/) {
$args .= "--reviewer=$1 ";
@@ -88,12 +88,15 @@ non-option style arguments can be:
a string of lower case letters, denoting a reviewer name.
-anything else will be used as a commit range.
+a string starting with \@, denoting a reviewer's github ID.
+
+anything else will be used as a commit range. If no commit range is given,
+HEAD^.. is assumed.
Examples (all meaning the same thing):
addrev -2 steve levitte
- addrev steve levitte HEAD^^..
- addrev --reviewer=steve --reviewer=levitte -2
+ addrev steve \@levitte HEAD^^..
+ addrev --reviewer=steve --reviewer=levitte\@openssl.org -2
EOF
}
diff --git a/review-tools/gitaddrev b/review-tools/gitaddrev
index 13a7f8c..4dfd04b 100755
--- a/review-tools/gitaddrev
+++ b/review-tools/gitaddrev
@@ -32,12 +32,13 @@ my $omccount = 0;
sub try_add_reviewer {
my $id = shift;
my $rc = undef;
- my $rev = $query->find_person_tag($id, 'rev');
+ my $id2 = $id =~ /^\@(.*)$/ ? { github => $1 } : $id;
+ my $rev = $query->find_person_tag($id2, 'rev');
if ($rev) {
my $cla = $query->has_cla($rev);
if ($cla) {
unless (grep {$_ eq $rev} @reviewers) {
- $omccount++ if $query->is_member_of($id, 'omc');
+ $omccount++ if $query->is_member_of($id2, 'omc');
push @reviewers, $rev;
}
$rc = $rev;
@@ -48,7 +49,7 @@ sub try_add_reviewer {
} else {
push @unknown_reviewers, $id
unless grep {$_ eq $id} @unknown_reviewers;
- unless ($id =~ m|^.*\@.*$| && $query->has_cla($id)) {
+ unless ($id =~ m|^.+\@.*$| && $query->has_cla($id)) {
push @nocla_reviewers, $id
unless grep {$_ eq $id} @nocla_reviewers;
}
@@ -64,13 +65,16 @@ foreach (@ARGV) {
my $rev = $query->find_person_tag($email_id, 'rev');
my $omc = $query->is_member_of($email_id, 'omc');
next unless $query->has_cla($rev);
- my @ids = sort grep { $_ =~ m|^[a-z][-a-z]*$| } map {
- if (ref($_) eq "HASH") {
- values %$_;
- } else {
- $_;
- }
- } @$_;
+ my @ids =
+ sort grep { $_ =~ /^[a-z]+$/ || $_ =~ /^\@(?:\w|\w-\w)+$/ }
+ map {
+ if (ref($_) eq "HASH") {
+ my %h = %$_;
+ map { $_ eq "github" ? '@'.$h{$_} : $h{$_} } %h;
+ } else {
+ $_;
+ }
+ } @$_;
foreach (@ids) {
$list{$_} = { tag => $rev, omc => $omc };
}
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits