App-Gitc
view release on metacpan or search on metacpan
bin/gitc-promote view on Meta::CPAN
my @extras = map { full_changeset_name($_) }
unpromoted( \@wanted, "origin/$target" );
# find refs that weren't explicitly listed
my %extras = map { ( $_ => 1 ) } @extras;
delete @extras{@wanted};
return keys %extras;
}
# given a list of requested changeset refs and a list of missing dependency
# refs, prompts the user what to do and returns a new list of requested
# changeset refs
sub handle_missing_dependencies {
my ( $wanted, $missing ) = @_;
my @pretty = map { short_ref_name($_) } @$missing;
sort_changesets_by_name(\@pretty);
warn "The following changeset dependencies are missing:\n";
warn " - $_\n" for @pretty;
die "Exiting promotion because of missing dependencies\n" if not -t STDIN;
print STDERR 'What do you want to do? '
lib/App/Gitc/Util.pm view on Meta::CPAN
);
}
sub confirm {
my ($message) = @_;
die "No message given to 'confirm'" if not defined $message;
require Term::ReadLine;
my $term = Term::ReadLine->new('gitc');
my $prompt = "$message ";
my $response;
# prompt the user
while ( defined( $response = $term->readline($prompt) ) ) {
return 1 if $response eq 'y';
return if $response eq 'n';
$prompt = "$message ('y' or 'n') ";
}
}
# If this ever needs to be faster, it can be implemented by opening
# .git/HEAD and parsing the one line contents. It would take a bit
# more effort to get it right, but it would avoid the fork+exec overhead
sub current_branch {
my ($name) = grep /^[*]/, qx{ git branch --no-color };
chomp $name;
( run in 1.108 second using v1.01-cache-2.11-cpan-6aa56a78535 )