[Git][debian-gis-team/scripts][master] Set merge method to fast-forward.
Bas Couwenberg
gitlab at salsa.debian.org
Thu Dec 12 16:10:11 GMT 2019
Bas Couwenberg pushed to branch master at Debian GIS Project / scripts
Commits:
d589e5e1 by Bas Couwenberg at 2019-12-12T16:09:58Z
Set merge method to fast-forward.
- - - - -
2 changed files:
- salsa-configure-repositories.pl
- salsa-create-repository.pl
Changes:
=====================================
salsa-configure-repositories.pl
=====================================
@@ -125,6 +125,11 @@ foreach my $project (@{$team_projects}) {
exit 1;
}
+ # Set merge method
+ if(!set_merge_method($project)) {
+ exit 1;
+ }
+
# Disable Show link to create/view merge request when pushing from the command line
if(!disable_printing_merge_request_link($project)) {
exit 1;
@@ -328,6 +333,50 @@ sub disable_issues {
}
}
+sub set_merge_method {
+ my ($project) = @_;
+
+ if($project->{merge_method} ne 'ff') {
+ print "Setting merge method for: ". $project->{name} ." (". $project->{id} .")\n" if($cfg{verbose});
+
+ my $url = $cfg{url}.'/projects/'.uri_escape($project->{id});
+
+ my %param = (
+ id => $project->{id},
+ name => $project->{name},
+ merge_method => 'ff',
+ );
+
+ print "param:\n".Dumper(\%param) if($cfg{debug});
+
+ my $req = HTTP::Request::Common::PUT($url, [ %param ]);
+ $req->header('PRIVATE-TOKEN' => $cfg{token});
+
+ my $res = $ua->request($req);
+ if($res->is_success) {
+ my $content = $res->content;
+
+ print "Content:\n".Dumper($content) if($cfg{debug});
+
+ print "Set merge method for project: ". $project->{name} ." (". $project->{id} .")\n" if($cfg{verbose});
+
+ return 1;
+ }
+ else {
+ print "Error: Request failed! ($url)\n";
+ print "HTTP Status: ".$res->code." ".$res->message."\n";
+ print $res->content if($res->content);
+
+ return;
+ }
+ }
+ else {
+ print "Merge method is already fast-forward.\n" if($cfg{verbose});
+
+ return 2;
+ }
+}
+
sub disable_printing_merge_request_link {
my ($project) = @_;
=====================================
salsa-create-repository.pl
=====================================
@@ -321,6 +321,7 @@ sub create_project {
visibility => $cfg{visibility},
ci_config_path => $cfg{ci_cfg_path},
issues_enabled => 'false',
+ merge_method => 'ff',
printing_merge_request_link_enabled => 'false',
);
View it on GitLab: https://salsa.debian.org/debian-gis-team/scripts/commit/d589e5e159130db60a43054f8f145640dcb0e3a7
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/scripts/commit/d589e5e159130db60a43054f8f145640dcb0e3a7
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20191212/4245f6a6/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list