This file is indexed.

/usr/share/perl5/SVN/Web/Revision.pm is in libsvn-web-perl 0.63-2.

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

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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
package SVN::Web::Revision;

use strict;
use warnings;

use base 'SVN::Web::action';

use Encode ();
use SVN::Core;
use SVN::Ra;
use SVN::Web::X;
use SVN::Web::DiffParser;

our $VERSION = 0.63;

=head1 NAME

SVN::Web::Revision - SVN::Web action to view a repository revision

=head1 SYNOPSIS

In F<config.yaml>

  actions:
    ...
    revision:
      class: SVN::Web::Revision
      opts:
        max_diff_size: 200_000
        show_diff: 1 # or 0
    ...

=head1 DESCRIPTION

Shows information about a specific revision in a Subversion repository.

=head1 CONFIGURATION

The following configuration options may be specified in F<config.yaml>.

=over

=item max_diff_size

If showing the diff (see C<show_diff>), this determines the maximum size
of the diff that will be shown.  If the size of the generated diff (in
bytes) is larger than this figure then it is not shown.

Defaults to 200,000 bytes.

=item show_diff

Boolean indicating whether or not a diff of every file that was changed
in the revision should be shown.

Defaults to 1.

=back

=head1 OPTIONS

=over 8

=item rev

The revision to show.  If not provided then use the repository's
youngest revision.

=back

=head1 TEMPLATE VARIABLES

=over 8

=item context

Always C<revision>.

=item rev

The revision that is being shown.

=item youngest_rev

The repository's youngest revision.  This is useful when constructing
C<next revision> and C<previous revision> links.

=item date

The date on which the revision was committed, formatted according to
L<SVN::Web/"Time and date formatting">.

=item author

The revision's author.

=item msg

The log message associated with this revision.

=item paths

A hash of hash refs.  Each key is a path name.  The value is a further hash ref
with the following keys.

=over 8

=item isdir

A boolean value, true if the given path is a directory.

=item diff

A L<SVN::Web::DiffParser> object representing the diff.  This may be undef,
if the generated diff was larger than C<max_diff_size> or if C<show_diff>
is false.

=item diff_size

The size of the generated diff (before parsing).

=item max_diff_size

The configured maximum diff size.

=item action

A single letter indicating the action that carried out on the path.  A
file was either added C<A>, modified C<M>, replaced C<R>, or deleted
C<D>.

=item copyfrom

If the file was copied from another file then this is the path of the
source of the copy.

=item copyfromrev

If the file was copied from another file then this is the revision of
the file that it was copied form.

=back

=back

=head1 EXCEPTIONS

=over 4

=item (revision %1 does not exist)

The given revision does not exist in the repository.

=back

=cut

my %default_opts = (
    max_diff_size => 200_000,
    show_diff     => 1,
);

sub _log {
    my ( $self, $paths, $rev, $author, $date, $msg, $pool ) = @_;

    my $data = {
        rev    => $rev,
        author => $author,
        date   => $self->format_svn_timestamp($date),
        msg    => Encode::decode('utf8',$msg),
    };

    $data->{paths} = {
        map {
            $self->decode_svn_uri($_) => {
                action      => $paths->{$_}->action(),
                copyfrom    => $paths->{$_}->copyfrom_path(),
                copyfromrev => $paths->{$_}->copyfrom_rev(),
              }
          } keys %$paths
    };

    return $data;
}

sub cache_key {
    my $self = shift;

    return $self->{cgi}->param('rev') if defined $self->{cgi}->param('rev');

    return $self->{repos}{ra}->get_latest_revnum();
}

sub run {
    my $self = shift;

    $self->{opts} = { %default_opts, %{ $self->{opts} } };

    my $ra   = $self->{repos}{ra};
    my $yrev = $ra->get_latest_revnum();

    my $uri  = $self->{repos}{uri};

    my $rev           = $self->{cgi}->param('rev');
    my $max_diff_size = $self->{opts}{max_diff_size};

    $rev = $yrev unless defined $rev;

    SVN::Web::X->throw(
        error => '(revision %1 does not exist)',
        vars  => [$rev]
    ) if $rev > $yrev;

    $ra->get_log( [''], $rev, $rev, 1, 1, 1,
        sub { $self->{REV} = $self->_log(@_) } );

    $self->_resolve_changed_paths();

    my $diff;
    my $diff_size = 0;
    if ( $self->{opts}{show_diff} ) {
        my $out = Encode::decode('utf8', $self->svn_get_diff($uri, $rev - 1, $uri, $rev, 1));
        $diff_size = length($out);
        if ( $diff_size <= $max_diff_size ) {
            $diff = SVN::Web::DiffParser->new($out);
        }
    }

    return {
        template => 'revision',
        data     => {
            context       => 'revision',
            rev           => $rev,
            youngest_rev  => $yrev,
            diff          => $diff,
            diff_size     => $diff_size,
            max_diff_size => $max_diff_size,
            %{ $self->{REV} },
        }
    };
}

# Add 'isdir' keys to the paths if appropriate.
#
# This code used to be in get_log() when it used the repos layer.  When
# the code was changed to use the ra layer it had to be moved out, as you
# can't call ra functions from a get_log() callback.
#
# XXX Very similar code in Log.pm, needs refactoring
sub _resolve_changed_paths {
    my $self    = shift;
    my $uri     = $self->{repos}{uri};
    my $data    = $self->{REV};

    my $subpool = SVN::Pool->new();
    # Set the 'isdir' key
    foreach my $path ( keys %{ $data->{paths} } ) {
        # Ignore deleted nodes
        if ( $data->{paths}{$path}{action} ne 'D' ) {
            my $node_kind = $self->svn_get_node_kind("$uri$path", $data->{rev}, $data->{rev}, $subpool);

            $data->{paths}{$path}{isdir} = $node_kind == $SVN::Node::dir;
        }

        $subpool->clear();
    }
}

1;

=head1 COPYRIGHT

Copyright 2003-2004 by Chia-liang Kao C<< <clkao@clkao.org> >>.

Copyright 2005-2007 by Nik Clayton C<< <nik@FreeBSD.org> >>.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See L<http://www.perl.com/perl/misc/Artistic.html>

=cut