Skip to content

Instantly share code, notes, and snippets.

@k12u
Created August 9, 2011 12:06
Show Gist options
  • Save k12u/1133872 to your computer and use it in GitHub Desktop.
Save k12u/1133872 to your computer and use it in GitHub Desktop.
svn ls helper
#!/usr/bin/perl
use strict;
#use warnings;
use Getopt::Std;
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]);
my $sub_dir = (($ARGV[0] eq "-t") ? "tags/" : "branches/");
my $cmd = sprintf("svn ls --verbose %s\n", ($root_path . $sub_dir));
print `$cmd`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment