-
Notifications
You must be signed in to change notification settings - Fork 2
/
convert
executable file
·50 lines (35 loc) · 1.25 KB
/
convert
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Time::HiRes qw( time );
use Capture::Tiny ':all';
my $rsync_dest = $ENV{HOME} . '/github/dvn/dvn-sf-rsync';
my ( $cmd, @args );
$cmd = 'rsync';
#@args = ( '-av', 'rce:public_html', $rsync_dest ); # quick test
@args = ( '-av', 'dvn.svn.sourceforge.net::svn/dvn/*', $rsync_dest );
run_cmd( $cmd, @args );
$cmd = 'svn2git';
#@args = ( "file://$ENV{HOME}/github/dvn/dvn-sf-rsync", '--authors', 'authors.txt', '--trunk', 'dvn-app/trunk', '--branches', 'dvn-app/branches' );
@args = ( "file://$ENV{HOME}/github/dvn/dvn-sf-rsync", '--authors', 'authors.txt', '--rootistrunk' );
run_cmd( $cmd, @args );
sub run_cmd {
my ( $cmd, @args ) = @_;
my $start = time();
say "Running `$cmd @args`";
my ( $stdout, $stderr, $exit );
( $stdout, $stderr, $exit ) = capture {
system( $cmd, @args );
};
if ($exit) {
my $exit_code = $exit >> 8;
$exit_code -= 256 if $exit_code > 127;
die "$cmd returned an non-zero exit code ($exit_code)! The error was:\n$stderr";
}
else {
say "$cmd command completed successfully";
}
my $end = time();
printf( "Time elapsed: %.2f seconds (%.2f minutes)\n", $end - $start, ( $end - $start ) / 60 );
}