[Bps-public-commit] Shipwright branch, master, updated. 8378815a661c04707702ae65eb702faae23fd635
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Oct 12 19:55:50 EDT 2009
The branch, master has been updated
via 8378815a661c04707702ae65eb702faae23fd635 (commit)
via 51c92c91d2bff6b169742b6c8f5223767e8e8608 (commit)
via abc42777a9d9362967345b736c74b6380620b95c (commit)
from 702c805a8332a282721774804f35c5f10a5ffd52 (commit)
Summary of changes:
lib/Shipwright/Backend/Git.pm | 45 +++++++++++++++++++++++++++++++++-----
lib/Shipwright/Script/Import.pm | 2 +-
lib/Shipwright/Util.pm | 4 ++-
3 files changed, 43 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit abc42777a9d9362967345b736c74b6380620b95c
Author: Robert Buels <rmb32 at cornell.edu>
Date: Mon Oct 12 09:59:25 2009 -0700
added cwd to Util.pm run() error output
diff --git a/lib/Shipwright/Util.pm b/lib/Shipwright/Util.pm
index 9b76149..6d256d5 100644
--- a/lib/Shipwright/Util.pm
+++ b/lib/Shipwright/Util.pm
@@ -5,7 +5,7 @@ use strict;
use Carp;
use IPC::Run3;
use File::Spec::Functions qw/catfile catdir splitpath splitdir tmpdir rel2abs/;
-use Cwd qw/abs_path/;
+use Cwd qw/abs_path getcwd/;
use Shipwright; # we need this to find where Shipwright.pm lives
use YAML::Tiny;
@@ -69,9 +69,11 @@ sub run {
unless ($ignore_failure) {
$out = "\n$out" if length $out;
$err = "\n$err" if length $err;
+ my $cwd = getcwd;
confess <<"EOF";
command failed: @$cmd
\$?: $?
+cwd: $cwd
stdout was: $out
stderr was: $err
EOF
commit 51c92c91d2bff6b169742b6c8f5223767e8e8608
Author: Robert Buels <rmb32 at cornell.edu>
Date: Mon Oct 12 11:06:44 2009 -0700
fixed repos initialization for git backend, should fix RT #49928
diff --git a/lib/Shipwright/Backend/Git.pm b/lib/Shipwright/Backend/Git.pm
index d4ae409..f26283b 100644
--- a/lib/Shipwright/Backend/Git.pm
+++ b/lib/Shipwright/Backend/Git.pm
@@ -61,20 +61,53 @@ sub initialize {
my $dir = $self->SUPER::initialize(@_);
my $path = $self->repository;
- $path =~ s!^file://!!; # this is always true since we check that before
+ $path =~ s!^file://!! # this should always true since we check that before
+ or die 'sanity check failed';
Shipwright::Util->run( sub { remove_tree( $path ) } );
Shipwright::Util->run( sub { make_path( $path ) } );
- my $cwd = getcwd;
- chdir $path;
- Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, '--bare', 'init' ] );
+ $self->_init_new_git_repos( $path );
- $self->_initialize_local_dir;
rcopy( $dir, $self->local_dir )
- or confess "can't copy $dir to " . $path . ": $!";
+ or confess "can't copy $dir to $path: $!";
$self->commit( comment => 'create project' );
+}
+
+sub _init_new_git_repos {
+ my $self = shift;
+ my $new_repos_dir = shift;
+
+ my $cwd = getcwd;
+
+ # make a new bare repos at the target path
+ chdir $new_repos_dir;
+ Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, '--bare', 'init' ] );
+
+ ### make a temporary non-bare repos to initialize the new bare
+ ### repos with, pushing from the regular repos to the bare one
+ my $dir =
+ tempdir( 'shipwright_backend_git_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+
+ chdir $dir;
+ Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, 'init' ] );
+
+ # touch a file in the non-bare repos
+ my $initial_file = '.shipwright_git_initial';
+ { open my $f, '>', $initial_file or confess "$! writing $dir/$initial_file" }
+
+ Shipwright::Util->run(
+ [ $ENV{'SHIPWRIGHT_GIT'}, 'add', $initial_file ] );
+ Shipwright::Util->run(
+ [ $ENV{'SHIPWRIGHT_GIT'}, 'commit', -m => 'initial commit, shipwright creating new git repository' ] );
+ Shipwright::Util->run(
+ [ $ENV{'SHIPWRIGHT_GIT'}, 'push', $new_repos_dir, 'master' ] );
+
chdir $cwd;
+
+ Shipwright::Util->run(sub{ remove_tree( $dir ) }); #< would not be necessary if used File::Temp->newdir instead
+
+ return $new_repos_dir;
}
sub _initialize_local_dir {
commit 8378815a661c04707702ae65eb702faae23fd635
Author: rob <rmb32 at cornell.edu>
Date: Mon Oct 12 15:46:54 2009 -0400
fixed typo in import script help
diff --git a/lib/Shipwright/Script/Import.pm b/lib/Shipwright/Script/Import.pm
index 5c2cae7..8383b9c 100644
--- a/lib/Shipwright/Script/Import.pm
+++ b/lib/Shipwright/Script/Import.pm
@@ -424,7 +424,7 @@ Shipwright::Script::Import - Import sources and their dependencies
=head1 SYNOPSIS
- import SOURCE [NAME]
+ import SOURCE [ SOURCE ] ...
=head1 OPTIONS
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list