Created
August 9, 2011 12:06
-
-
Save k12u/1133871 to your computer and use it in GitHub Desktop.
svn copy helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Getopt::Std; | |
my %opts; | |
Getopt::Std::getopts('b:t:', \%opts); | |
my $svn_info = `svn info|grep URL`; | |
die "not http repository: $svn_info" unless $svn_info =~ /^URL: https?.+$/sm; | |
die "trunk/branches directory not found in svn info: $svn_info" unless $svn_info =~ m#^URL: https?.+/(branches|tags|trunk)#sm; | |
my ($root_path) = (($svn_info =~ m#^URL: (https?.+/)(branches|tags|trunk).*$#sm)[0]); | |
printf("svn copy %s %s\n", ($root_path . "trunk"), ($root_path . "branches/" . $opts{b})) if($opts{b}); | |
printf("svn copy %s %s\n", ($root_path . "trunk"), ($root_path . "tags/" . $opts{t})) if($opts{t}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment