App-GitGerrit

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    area is dirty.

  [Changes]
  - Gerrit error messages are now formatted in a way that make them
    more understandable.

  - The full path of the commit-msg hook being installed is shown in
    the debug messages.

  [Fixes]
  - Usernames are now URI-escaped before being inserted in REST URLs.

0.013     2013-10-07 23:19:19 America/Sao_Paulo

  [Changes]
  - Require, instead of just recommend, Text::Table and better format
    the output of 'git gerrit reviewer'.

  - The reviewer's names are always printed in full now.

  - Reformat the output of 'git gerrit version' when Gerrit is version

lib/App/GitGerrit.pm  view on Meta::CPAN

# relays REST calls.

sub gerrit {
    my $method = shift;

    state $gerrit;
    unless ($gerrit) {
        my ($username, $password) = get_credentials;
        require Gerrit::REST;
        $gerrit = Gerrit::REST->new(config('baseurl'), $username, $password);
        eval { $gerrit->GET("/projects/" . uri_escape_utf8(config('project'))) };
        if (my $error = $@) {
            set_credentials($username, $password, 'reject') if $error->{code} == 401;
            die $error;
        } else {
            set_credentials($username, $password, 'approve');
        }
    }

    if ($Options{debug}) {
        my ($endpoint, @args) = @_;

lib/App/GitGerrit.pm  view on Meta::CPAN

# array-refs, each containing a list of change descriptions.

sub query_changes {
    my @queries = @_;

    return [] unless @queries;

    # If we're inside a git repository, restrict the query to the
    # current project's reviews.
    if (my $project = config('project')) {
        $project = uri_escape_utf8($project);
        @queries = map "q=project:$project+$_", @queries;
    }

    push @queries, "n=$Options{limit}" if $Options{limit};

    push @queries, "o=LABELS";

    my $changes = gerrit_or_die(GET => "/changes/?" . join('&', @queries));
    $changes = [$changes] if ref $changes->[0] eq 'HASH';

lib/App/GitGerrit.pm  view on Meta::CPAN

        'confirm',
        'delete=s@',
    );

    grok_unspecified_change;

    foreach my $id (@ARGV) {
        # First try to make all deletions
        if (my $users = $Options{delete}) {
            foreach my $user (split(/,/, join(',', @$users))) {
                $user = uri_escape_utf8($user);
                gerrit_or_die(DELETE => "/changes/$id/reviewers/$user");
            }
        }

        # Second try to make all additions
        if (my $users = $Options{add}) {
            my $confirm = $Options{confirm} ? 'true' : 'false';
            foreach my $user (split(/,/, join(',', @$users))) {
                gerrit_or_die(POST => "/changes/$id/reviewers", { reviewer => $user, confirm => $confirm});
            }



( run in 0.709 second using v1.01-cache-2.11-cpan-c21f80fb71c )