9 our $PROGRAM_DIR = $ENV{XR_PERL_SOURCE_DIR
};
10 unless($PROGRAM_DIR) {
12 $PROGRAM_DIR =~ s/[^\/\\]+$//;
13 $PROGRAM_DIR =~ s/\/+$//;
14 $PROGRAM_DIR = "." unless($PROGRAM_DIR);
17 map "$PROGRAM_DIR/$_",qw{modules lib
../modules
..lib
};
21 my @OPTIONS = qw
/help|h|? version|ver edit-me manual|man/;
26 require MyPlace
::Usage
;
27 Getopt
::Long
::GetOptions
(\
%OPTS,@OPTIONS);
28 MyPlace
::Usage
::Process
(\
%OPTS,$VERSION);
32 require MyPlace
::Usage
;
33 MyPlace
::Usage
::PrintHelp
();
38 my $exit = system(@_);
39 die("fatal error: $! while executing [",join(" ",@_),"]\n") if($exit);
45 my $source_user = shift;
46 my $sync_user = shift;
48 my $is_localsource = 1;
55 elsif($DEST =~ m/:\/\
//) {
56 $is_localdest = undef;
58 elsif($DEST =~ m/\//) {
61 $DEST = $cwd . '/' . $DEST;
63 if($SOURCE =~ m/:\/\
//) {
64 $is_localsource = undef;
66 elsif($SOURCE =~ m/\//) {
69 $SOURCE = $cwd . '/' . $SOURCE;
72 my $SOURCE_URL = $is_localsource ?
'file://' . $SOURCE : $SOURCE;
75 $DEST_URL = 'file://' . $DEST;
77 print STDERR
"creating local repository $DEST...\n";
78 run
(qw
/svnadmin create/,$DEST);
79 my $hook = "$DEST/hooks/pre-revprop-change";
80 print STDERR
"creating pre-revprop-change hook in $DEST...\n";
81 open FO
,'>',$hook or die("fatal error\n");
82 print FO
"#!/bin/sh\nexit 0\n";
84 run
(qw
/chmod a+x/,$hook);
92 if($source_user and $sync_user) {
93 @svnsync = ('svnsync','--source-username',$source_user,'--sync-username',$sync_user);
96 @svnsync = ('svnsync','--username',$source_user);
99 @svnsync = ('svnsync');
101 print STDERR
"initializing svnsync...\n";
102 print STDERR
"from\t$SOURCE_URL\n";
103 print STDERR
"to \t$DEST_URL\n";
104 run
(@svnsync,'init',$DEST_URL,$SOURCE_URL);
105 print STDERR
"start syncing...\n";
106 run
(@svnsync,'sync',$DEST_URL);
117 svn-clone - clone subversion repository
121 svn-clone [options] <SOURCE_REPO> [DEST_REPO]
129 Print version infomation.
131 =item B<-h>,B<--help>
133 Print a brief help message and exits.
135 =item B<--manual>,B<--man>
137 View application manual
141 Invoke 'editor' against the source
151 2010-11-19 03:13 xiaoranzzz <xiaoranzzz@myplace.hell>
157 xiaoranzzz <xiaoranzzz@myplace.hell>