App-Gitc

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an

bin/gitc-open  view on Meta::CPAN

    my $owner = history_owner($history);
    my $status = history_status($history);
    die   "A changeset named '$changeset_name' already exists.\n"
        . "It was created by $owner and currently has status $status.\n"
        . "For more details, try 'gitc history $changeset_name'\n"
        ;
}


git_fetch_and_clean_up() if is_auto_fetch();
$onto = validate_onto_argument( $changeset_name, $onto );
my $branch = current_branch();

my $stash;
reversibly {
    failure_warning "\nCanceling gitc open\n";

    $stash = guarantee_a_clean_working_directory();
    to_undo { git "stash apply $stash" if $stash; $stash = undef };

    # create a new branch for this changeset

bin/gitc-open  view on Meta::CPAN

    };
    warn "Updating $its_name failed! $@\n" if $@;
}

# reinstate any changes present when we started
git "stash apply $stash" if $stash;


###################### helper subs ######################

# validates and defaults the --onto command line argument
# most of this code has to do with choosing an intelligent default
sub validate_onto_argument {
    my ($changeset, $onto) = @_;
    return "origin/$onto" if $onto and $onto =~ m/^(master|test|stage|prod)$/;

    # default e1234c to e1234b (unless e1234b is far enough along)
    if ( not defined $onto ) {
        if ( my $previous = find_previous_changeset($changeset) ) {
            my @merged_to = changeset_merged_to($previous);
            my $default_onto = project_config()->{ open_onto };
            $onto = $previous if not @merged_to;
            $onto = $previous if none { $_ eq $default_onto } @merged_to;

bin/gitc-pass  view on Meta::CPAN

    'skip-email' => \$skip_email,
    'from-self-review' => sub {
        $self_review = 1;
        $skip_email  = 1;
    },
);
is_suspendable();
my $changeset = current_branch();
die "You can't pass the master branch\n" if $changeset eq 'master';

# validate the current status
my $history = history($changeset);
my $status = history_status($history);
die   "This changeset has status '$status' but it must be 'reviewing' for\n"
    . "you to pass it.\n"
    if $status ne 'reviewing';

my $stash;
my $send_email;
reversibly {
    failure_warning "\nAborting gitc pass\n";

bin/gitc-promote  view on Meta::CPAN

########################## helper subs ###########################

# determine what we're promoting and where
sub parse_command_line {
    my @argv = @_;

    # extract structure from the command line
    my $target = pop @argv;
    my @changesets = grep { !/^-/ } @argv;

    # validate the promotion target
    die "You must specify a promotion target\n" if not $target;
    die "Invalid promotion target '$target'\n"
        if not defined environment_preceding($target);

    # validate changesets
    my $refs = validate_changesets( $target, @changesets );
    return ( $target, $refs, \@changesets );
}

# checks a list of changeset names for sanity. dies on anything bad.
# if the changesets are ok, it returns an arrayref of Git refs for
# those changesets
sub validate_changesets {
    my ( $target, @changesets ) = @_;
    return ( $target, [] ) if not @changesets;
    die "You may not cherry pick promote to prod\n"
        if !$force and $target eq 'prod' and @changesets;

    warn "Validating changesets\n";
    my @refs;
    my @already_promoted;
    my %seen;
    for my $changeset (@changesets) {

bin/gitc-show  view on Meta::CPAN

# should we fetch from the origin?
my $fetch = 0;
GetOptions( 'fetch' => \$fetch );
git "fetch origin" if $fetch;

# verify the changeset name
my $changeset = shift || current_branch();
my $history = history($changeset);
die "There is no changeset named '$changeset'\n" if not @$history;

# validate the changeset status
my $status = history_status($history);
die   "Changeset $changeset has status '$status' so the code only\n"
    . "exists in the developer's personal repository.  If you want\n"
    . "to see what he's up to, ask him nicely to show you.\n"
    if $status eq 'open';

# try to find the changeset's branch point
my $head = full_changeset_name($changeset, missing_ok => 1);

if (not $head)

bin/gitc-submit  view on Meta::CPAN

    }

    # blast out the emails
    git "send-email --to " . get_user_email($reviewer)
      . '           --from "' . author_email() . '"'
      . '           --no-chain-reply-to'
      . '           --signed-off-by-cc'
      . '           --suppress-cc author'
      . '           --suppress-from'
      . '           --quiet'
      . '           --no-validate'
      . "           $tmpdir/*.patch"
      if not $skip_email
      ;

    if ($its) {
        # update the Issue status
        my $issue = $its->get_issue($changeset, reload => 1);
        my $project = project_name();
        my $what_happened = $its->transition_state({
            command   => 'submit',

bin/gitc-submit  view on Meta::CPAN

    my $current_user = get_user_name();
    if ( $reviewer eq $current_user ) {
        if ( project_config()->{'self submit'} ) {
            $self_review = 1;
            $skip_email  = 1;
            $keep        = 1;
            return $reviewer;
        }
    }

    validate_reviewer($reviewer);
    return $reviewer;
}

# determine whether the given reviewer is valid.  if not, suggest
# an alternative based on possible mis-spellings
sub validate_reviewer {
    my ($reviewer) = @_;
   
    fetch_tags(); 
    my @users = user_lookup_class()->users();

    return if any { $_ eq $reviewer } @users;

    # an invalid reviewer.  make some suggestions
    require Text::Levenshtein;
    require List::Util;

lib/App/Gitc/Its/Eventum.pm  view on Meta::CPAN

sub transition_state {
    my $self = shift;
    my ($args) = @_;
    $args ||= {};
    $args->{with_time} = 1 unless exists $args->{with_time};
    return "Skipping Eventum changes, as requested by GITC_NO_EVENTUM\n"
        if $ENV{GITC_NO_EVENTUM};
    return "Skipping Eventum changes as configured for this project\n"
        if not project_config()->{'eventum_uri'};

    # validate the arguments
    my $command = $args->{command} || command_name();
    my ($from, $to) = $self->_states( $command, $args->{target} );
    my $message = $args->{message} or die "No eventum message";
    my $issue = exists $args->{issue} ? $args->{issue} :
                                        $self->get_issue(current_branch(), reload => 1);
    return "NOT CHANGING Eventum status: changeset not in Eventum?\n"
        if not $issue;

    # update the Eventum issue
    my $time_format = '%m/%d/%Y';

lib/App/Gitc/Its/Github.pm  view on Meta::CPAN

}

sub transition_state {
    my ($self, $args) = @_;
    $args ||= {};
    $args->{with_time} = 1 unless exists $args->{with_time};
    return "Skipping Github changes, as requested by GITC_NO_GITHUB\n"
        if $ENV{GITC_NO_GITHUB};

    my $label = $self->label_issue;
    # validate the arguments
    my ($command, $message, $reviewer, $issue) = @{$args}{qw/command message reviewer issue/};
    die "No message" unless $message;
    $issue = $self->get_issue(current_branch(), reload => 1) unless defined $issue;
    return "NOT CHANGING Github $label: changeset not in Github?\n"
        if not $issue;
    my $state = $self->_states( $command, $args->{target} );
    my $to = $state->{to};
    my $from = $self->last_status($args->{changeset});

    $message = get_user_name()   # user's name

lib/App/Gitc/Its/Jira.pm  view on Meta::CPAN

    my ($args) = @_;
    $args ||= {};
    $args->{with_time} = 1 unless exists $args->{with_time};
    return "Skipping JIRA changes, as requested by GITC_NO_EVENTUM\n"
        if $ENV{GITC_NO_EVENTUM};
    return "Skipping JIRA changes as configured for this project\n"
        if not project_config()->{'jira_uri'};

    my $label = $self->label_issue;

    # validate the arguments
    my $command = $args->{command} || command_name();
    my $state = $self->_states( $command, $args->{target} );
    my $from = $state->{from};
    my $to = $state->{to};
    my $flag = $state->{flag};
    my $message = $args->{message} or die "No message";
    my $reviewer = $args->{reviewer};
    my $issue = exists $args->{issue} ? $args->{issue} :
                                        $self->get_issue(current_branch(), reload => 1);
    return "NOT CHANGING JIRA $label: changeset not in JIRA?\n"



( run in 0.584 second using v1.01-cache-2.11-cpan-beeb90c9504 )