chiark / gitweb /
my-debmirror: Set up sarge and sid symlinks.
[bin.git] / svnpath
1 #!/usr/bin/perl
2 # Work out paths in a subversion repository for branches or tags of the
3 # given directory. Works on current directory by default, or it can be given
4 # a path.
5
6 my $wanted=shift;
7
8 # Get the svn url of the current directory.
9 my $url = `svn info @ARGV| grep -i ^URL: | cut -d ' ' -f 2`;
10 if (! length $url) {
11         die "cannot get url";
12 }
13
14 if (length $wanted) {
15         # Now jut substitute into it.
16         $url=~s!/(?:trunk|branches|tags|upstream)($|/)!/$wanted$1!;
17 }
18 print $url;