summaryrefslogtreecommitdiffstats
path: root/lib/Devscripts/Uscan/svn.pm
blob: 65dacaee1bd7d95fd16f16a5195650e90813b610 (plain)
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
package Devscripts::Uscan::svn;

use strict;
use Cwd qw/abs_path/;
use Devscripts::Uscan::Output;
use Devscripts::Uscan::Utils;
use Devscripts::Uscan::_vcs;
use Dpkg::IPC;
use File::Path 'remove_tree';
use Moo::Role;

######################################################
# search $newfile $newversion (svn mode/versionless)
######################################################
sub svn_search {
    my ($self) = @_;
    my ($newfile, $newversion);
    if ($self->versionless) {
        $newfile = $self->parse_result->{base};
        spawn(
            exec => [
                'svn',          'info',
                '--show-item',  'last-changed-revision',
                '--no-newline', $self->parse_result->{base}
            ],
            wait_child => 1,
            to_string  => \$newversion
        );
        chomp($newversion);
        $newversion = sprintf '0.0~svn%d', $newversion;
        if (
            mangle(
                $self->watchfile,  \$self->line,
                'uversionmangle:', \@{ $self->uversionmangle },
                \$newversion
            )
        ) {
            return undef;
        }

    }
    ################################################
    # search $newfile $newversion (svn mode w/tag)
    ################################################
    elsif ($self->mode eq 'svn') {
        my @args = ('list', $self->parse_result->{base});
        ($newversion, $newfile)
          = get_refs($self, ['svn', @args], qr/(.+)/, 'subversion');
        return undef if !defined $newversion;
    }
    return ($newversion, $newfile);
}

sub svn_upstream_url {
    my ($self) = @_;
    my $upstream_url = $self->parse_result->{base};
    if (!$self->versionless) {
        $upstream_url .= '/' . $self->search_result->{newfile};
    }
    return $upstream_url;
}

*svn_newfile_base = \&Devscripts::Uscan::_vcs::_vcs_newfile_base;

sub svn_clean { }

1;