#!/usr/bin/env perl
use
5.12.0;
$|++;
my
$opt_list
;
my
$opt_remote
;
GetOption(
'l|list'
=> \
$opt_list
,
'remote=s'
=> \
$opt_remote
,
);
my
$re
= Git::Release->new;
if
(
$opt_list
) {
$re
->branch->hotfix_branches;
}
else
{
$opt_remote
||=
$re
->remote->origin;
my
$prefix
=
$re
->config->hotfix_prefix;
my
$hotfix
=
shift
;
my
$from
=
shift
||
'master'
;
my
$name
=
$prefix
.
'/'
.
$hotfix
;
say
"Creating hotfix branch $name."
;
my
$b
=
$re
->branch->new_branch(
$name
)->create(
from
=>
$from
);
$b
->checkout;
if
(
$opt_remote
) {
say
"Pushing feature branch @{[ $b->name ]} to remote $opt_remote... "
;
$b
->
push
(
$opt_remote
,
upstream
=> 1);
}
say
"Done"
;
}
1;