blob: bb53d7b2bf48133e53957a65eb670076567307ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/usr/bin/perl
use strict;
use warnings;
my ($remote, $id, $branch);
if (@ARGV == 1 and $ARGV[0] =~ /^[0-9]+$/) {
$remote = "origin";
$id = $branch = shift @ARGV;
} elsif (@ARGV == 2) {
$remote = shift @ARGV;
$id = $branch = shift @ARGV;
} elsif (@ARGV == 3) {
($remote, $id, $branch) = @ARGV;
} else {
die "usage: git mr [REMOTE_NAME] MERGE_REQUEST_ID [BRANCH_NAME]\n";
}
system "git fetch $remote merge-requests/$id/head";
system "git checkout -b mr/$branch FETCH_HEAD";
|