1
0
Fork 0

Adding upstream version 2.25.15.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
This commit is contained in:
Daniel Baumann 2025-06-21 11:04:07 +02:00
parent 10737b110a
commit b543f2e88d
Signed by: daniel.baumann
GPG key ID: BCC918A2ABD66424
485 changed files with 191459 additions and 0 deletions

View file

@ -0,0 +1,47 @@
package Devscripts::Salsa::rename_branch;
use strict;
use Devscripts::Output;
use Moo::Role;
with "Devscripts::Salsa::Repo";
our $prompt = 1;
sub rename_branch {
my ($self, @reponames) = @_;
my $res = 0;
my @repos = $self->get_repo($prompt, @reponames);
return @repos unless (ref $repos[0]); # get_repo returns 1 when fails
foreach (@repos) {
my $id = $_->[0];
my $str = $_->[1];
if (!$id) {
ds_warn "Branch rename has failed for $str (missing ID)\n";
return 1;
}
ds_verbose "Configuring $str";
my $project = $self->api->project($id);
eval {
$self->api->create_branch(
$id,
{
ref => $self->config->source_branch,
branch => $self->config->dest_branch,
});
$self->api->delete_branch($id, $self->config->source_branch);
};
if ($@) {
ds_warn "Branch rename has failed for $str\n";
ds_verbose $@;
unless ($self->config->no_fail) {
ds_verbose "Use --no-fail to continue";
return 1;
}
next;
}
}
return $res;
}
1;