Commit b4dd409c authored by gregor herrmann's avatar gregor herrmann

dpt-salsa: implement toattic/fromattic sub-commands.

GitLab::API::v4 has a transfer_project_to_namespace() method since 0.13.
parent c8300062
......@@ -7,7 +7,7 @@ use File::Spec;
use Getopt::Long;
use Git;
use GitLab::API::v4::Constants qw( :all ); # 0.11 for $GITLAB_ACCESS_LEVEL_NO_ACCESS
use GitLab::API::v4;
use GitLab::API::v4 0.13;
use JSON;
use Pod::Usage qw( pod2usage );
use Try::Tiny;
......@@ -137,6 +137,10 @@ if ( $command eq 'version' ) {
kgb();
} elsif ( $command eq 'mrconfig' ) {
mrconfig();
} elsif ( $command eq 'toattic' ) {
toattic();
} elsif ( $command eq 'fromattic' ) {
fromattic();
} elsif ( $command eq 'help' ) {
pod2usage(1);
} else {
......@@ -552,6 +556,24 @@ sub mrconfig {
unlink "$lastactivityoutdir/$_" for keys %currentlastactivityfiles;
}
## toattic()
sub toattic {
my ($repo) = shift || @args;
die 'Required parameter reponame|repoid missing.' unless $repo;
my $repo_path = repo2repopath($repo);
$api->transfer_project_to_namespace( $repo_path,
{ namespace => $config{perl_team_modules_attic_id} } );
}
## fromattic()
sub fromattic {
my ($repo) = shift || @args;
die 'Required parameter reponame|repoid missing.' unless $repo;
my $repo_path = repo2repopath($repo);
$api->transfer_project_to_namespace( $repo_path,
{ namespace => $config{perl_team_modules_packages_id} } );
}
# helper functions
## prettyjson($data)
sub prettyjson {
......@@ -775,13 +797,9 @@ Required unless C<--all> is used.
=head3 I<toattic|fromattic> I<repositoryid|repositoryname>
Moves a repository to/from the B<attic> sub-group of the B<modules> sub-group.
Useful when a package is removed from the archive.
Useful when a package is removed from the archive or added back.
B<WARNING>: Not implemented. According to
L<https://docs.gitlab.com/ce/api/groups.html#transfer-project-to-group> this
only works for admins. Trying it via B<GitLab::API::v4> leads to a C<403
forbidden> error. Use the web interface (which requires an extra
confirmation step) for now.
Probably needs appropriate permissions.
=head2 for managing users
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment