| Shipwright documentation | Contained in the Shipwright distribution. |
Shipwright::Script::Defaultbranch - Set the default branch for a source
shipwright defaultbranch cpan-Shipright 2.0
See also Shipwright::Manual::UsingBranches.
-r [--repository] REPOSITORY : specify the repository uri of our shipyard
-l [--log-level] LOGLEVEL : specify the log level
(info, debug, warn, error, or fatal)
--log-file FILENAME : specify the log file
sunnavy <sunnavy@bestpractical.com>
Shipwright is Copyright 2007-2011 Best Practical Solutions, LLC.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Shipwright documentation | Contained in the Shipwright distribution. |
package Shipwright::Script::Defaultbranch; use strict; use warnings; use Shipwright::Util; use base qw/App::CLI::Command Shipwright::Base Shipwright::Script/; use Shipwright; sub run { my $self = shift; my $name = shift; my $default = shift; confess_or_die "need name arg\n" unless $name; confess_or_die "need default arg\n" unless $default; my $shipwright = Shipwright->new( repository => $self->repository, ); my $branches = $shipwright->backend->branches; if ( grep { $default eq $_ } @{ $branches->{$name} } ) { # move $default to head @{ $branches->{$name} } = ( $default, grep { $_ ne $default } @{ $branches->{$name} } ); $shipwright->backend->branches($branches); $self->log->fatal( "successfully set default branch for $name, now it's $default"); } else { confess_or_die "$name doesn't have branches $default. Available branches are " . join( ', ', @{ $branches->{$name} } ) . "\n"; } } 1; __END__