This file is indexed.

/usr/bin/svnpath is in devscripts 2.11.6ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
#!/usr/bin/perl

=head1 NAME

svnpath - output svn url with support for tags and branches

=head1 SYNOPSIS

B<svnpath>

B<svnpath tags>

B<svnpath branches>

B<svnpath trunk>

=head1 DESCRIPTION

B<svnpath> is intended to be run in a subversion working copy.

In its simplest usage, B<svnpath> with no parameters outputs the svn url for
the repository associated with the working copy.

If a parameter is given, B<svnpath> attempts to instead output the url that
would be used for the tags, branches, or trunk. This will only work if it's
run in the top-level directory that is subject to tagging or branching.

For example, if you want to tag what's checked into subversion as version
1.0, you could use a command like this:

  svn cp $(svnpath) $(svnpath tags)/1.0

That's much easier than using svn info to look up the repository url and
manually modifying it to derive the url to use for the tag, and typing in
something like this:

  svn cp svn+ssh://my.server.example/svn/project/trunk svn+ssh://my.server.example/svn/project/tags/1.0

svnpath uses a simple heuristic to convert between the trunk, tags, and
branches paths. It replaces the first occurrence of B<trunk>, B<tags>, or
B<branches> with the name of what you're looking for. This will work ok for
most typical subversion repository layouts.

If you have an atypical layout and it does not work, you can add a
F<~/.svnpath> file. This file is perl code, which can modify the path in $url.
For example, the author uses this file:

 #!/usr/bin/perl
 # svnpath personal override file

 # For d-i I sometimes work from a full d-i tree branch. Remove that from
 # the path to get regular tags or branches directories.
 $url=~s!d-i/(rc|beta)[0-9]+/!!;
 $url=~s!d-i/sarge/!!;
 1

=cut

$ENV{LANG}="C";

my $wanted=shift;
my $path=shift;

if (length $path) {
	chdir $path || die "$path: unreadable\n";
}

our $url;
if (-d ".svn") {
	# Get the svn url of the current directory.
	$url = `svn info .| grep -i ^URL: | cut -d ' ' -f 2`;
}
else {
	# Try svk instead.
	$url = `svk info .| grep -i '^Depot Path:' | cut -d ' ' -f 3`;
}

if (! length $url) {
	die "cannot get url";
}

if (length $wanted) {
	# Now jut substitute into it.
	$url=~s!/(?:trunk|branches|tags)($|/)!/$wanted$1!;

	if (-e "$ENV{HOME}/.svnpath") {
		require "$ENV{HOME}/.svnpath";
	}
}

print $url;

=head1 LICENSE

GPL version 2 or later

=head1 AUTHOR

Joey Hess <joey@kitenet.net>

=cut