SVK

 view release on metacpan or  search on metacpan

lib/SVK/Command.pm  view on Meta::CPAN

820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
=cut
 
sub lock_target {
    my $self = shift;
    for my $target (@_) {
        $self->{xd}->lock ($target->copath_anchor)
            if $target->isa('SVK::Path::Checkout');
    }
}
 
=head3 lock_coroot ($target)
 
XXX Undocumented
 
=cut
 
sub lock_coroot {
    my $self = shift;
    my @tgt = map { $_->copath($_->{copath_target}) }
        grep { $_->isa('SVK::Path::Checkout') } @_;
    return unless @tgt;
    my %roots;
    for (@tgt) {
        my (undef, $coroot) = $self->{xd}{checkout}->get($_, 1);
        $roots{$coroot}++;
    }
    $self->{xd}->lock($_)
        for keys %roots;
}
 
=head3 brief_usage ($file)
 
Display an one-line brief usage of the command object.  Optionally, a file
could be given to extract the usage from the POD.

lib/SVK/Command/Branch.pm  view on Meta::CPAN

379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
    }
    return;
}
 
use base qw( https://metacpan.org/pod/SVK::Command::Move">SVK::Command::Move SVK::Command::Smerge SVK::Command::Delete SVK::Command::Branch::create );
 
sub lock { $_[0]->lock_coroot ($_[1]); };
 
sub parse_arg {
    my ($self, @arg) = @_;
    return if $#arg < 0;
 
    die loc ("Copy destination or source can't be URI.\n")
        if $self->ensure_non_uri (@arg);
    my $dst = pop(@arg);
 
    push @arg, '' unless @arg;

lib/SVK/Command/Commit.pm  view on Meta::CPAN

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    );
}
 
sub parse_arg {
    my ($self, @arg) = @_;
    @arg = ('') if $#arg < 0;
 
    return $self->arg_condensed (@arg);
}
 
sub lock { $_[0]->lock_coroot($_[1]) }
 
sub target_prompt {
    loc('=== Targets to commit (you may delete items from it) ===');
}
 
sub unversioned_prompt {
    loc("=== You may change '?' to 'A' to add unversioned items ===");
}
 
sub message_prompt {

lib/SVK/Command/Copy.pm  view on Meta::CPAN

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
        }
 
        $dst = $self->arg_depotpath("$path/");
    }
 
    return (@src, $dst);
}
 
sub lock {
    my $self = shift;
    $self->lock_coroot($_[-1]);
}
 
sub handle_co_item {
    my ($self, $src, $dst) = @_;
    $src = $src->as_depotpath;
    die loc ("Path %1 does not exist.\n", $src->path_anchor)
        if $src->root->check_path ($src->path_anchor) == $SVN::Node::none;
    my ($copath, $report) = ($dst->copath, $dst->report);
    die loc ("Path %1 already exists.\n", $copath)
        if -e $copath;

lib/SVK/Command/Mkdir.pm  view on Meta::CPAN

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
     'p|parent' => 'parent');
}
 
sub parse_arg {
    my ($self, @arg) = @_;
    return map { $self->{xd}->target_from_copath_maybe($_) } @arg;
}
 
sub lock {
    my $self = shift;
    $self->lock_coroot(@_);
}
 
sub ensure_parent {
    my ($self, $target) = @_;
    my $dst = $target->new;
    $dst->anchorify;
    die loc("Path %1 is not a checkout path.\n", $dst->report)
        unless $dst->isa('SVK::Path::Checkout');
    unless (-e $dst->copath) {
        die loc ("Parent directory %1 doesn't exist, use -p.\n", $dst->report)

lib/SVK/Command/Move.pm  view on Meta::CPAN

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# END BPS TAGGED BLOCK }}}
use strict;
use SVK::Versionour $VERSION = $SVK::VERSION;
use base qw( https://metacpan.org/pod/SVK::Command::Copy">SVK::Command::Copy );
use SVK::Util qw ( abs2rel );
 
sub lock {
    my $self = shift;
    $self->lock_coroot(@_);
}
 
sub handle_direct_item {
    my $self = shift;
    my ($editor, $anchor, $m, $src, $dst) = @_;
    my ($srcm) = $self->under_mirror ($src);
    my $call;
    if ($srcm && $srcm->path eq $src->path) {
        # XXX: this should be in svk::mirror
        my $props = $src->root->node_proplist($src->path);

lib/SVK/Path/Checkout.pm  view on Meta::CPAN

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
        my $cur = File::Spec::Unix->catdir(@path);
        $root->make_dir($cur)
            unless $root->check_path($cur);
    }
}
 
sub create_xd_root {
    my $self = shift;
    my $copath = $self->copath($self->copath_target);
 
    my (undef, $coroot) = $self->xd->{checkout}->get($copath, 1);
    Carp::cluck $copath.YAML::Syck::Dump($self->xd->{checkout}) unless $coroot;
    my @paths = $self->xd->{checkout}->find($coroot, {revision => qr'.*'});
 
    my $tmp = $self->_to_pclass($copath)->relative($coroot)->as_foreign('Unix')->absolute('/');
    $tmp = '' if $tmp eq '/';
 
    my $coroot_path = $self->path;
    $coroot_path =~ s/\Q$tmp\E$// or return $self->source->root;
    $coroot_path = '/' unless length $coroot_path;
 
    my $base_root = $self->source->root;
    return $base_root if $#paths <= 0;
 
    my $pool = SVN::Pool->new;
    my ($root, $base_rev);
    for (@paths) {
        $pool->clear;
        my $cinfo = $self->xd->{checkout}->get($_);
        my $path = abs2rel($_, $coroot => $coroot_path, '/');
        unless ($root) {
            $root = $base_root->txn_root($self->pool);;
            if ($base_root->revision_root_revision == 0) {
                # for interrupted checkout, the anchor will be at rev 0
                _mkpath($root, $path);
                $base_rev = 0;
            }
            else {
                $base_rev = $base_root->node_created_rev($path, $pool);
            }

lib/SVK/XD.pm  view on Meta::CPAN

483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
C<SVN::Repos> object if caller wants the repository to be opened.
 
=cut
 
sub find_repos_from_co {
    my ($self, $copath, $open) = @_;
    my $report = $copath;
    $copath = abs_path (File::Spec->canonpath ($copath));
    die loc("path %1 is not a checkout path.\n", $report)
        unless $copath;
    my ($cinfo, $coroot) = $self->{checkout}->get ($copath);
    die loc("path %1 is not a checkout path.\n", $copath) unless %$cinfo;
    my ($repospath, $path, $repos) = $self->find_repos ($cinfo->{depotpath}, $open);
 
    return ($repospath, abs2rel ($copath, $coroot => $path, '/'), $copath,
            $cinfo, $repos);
}
 
=item find_repos_from_co_maybe
 
Like C<find_repos_from_co>, but falls back to see if the given path is
a depotpath. In that case, the checkout paths returned will be undef.
 
=cut

lib/SVK/XD.pm  view on Meta::CPAN

568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# simliar to command::arg_copath, but still return a target when
# basepath doesn't exist, arg_copath should be gradually deprecated
sub target_from_copath_maybe {
    my ($self, $arg) = @_;
 
    my $rev = $arg =~ s/\@(\d+)$// ? $1 : undef;
    my ($repospath, $path, $depotpath, $copath, $repos, $view);
    unless (($repospath, $path, $repos) = eval { $self->find_repos ($arg, 1) }) {
        $arg = File::Spec->canonpath($arg);
        $copath = abs_path_noexist($arg);
        my ($cinfo, $coroot) = $self->{checkout}->get ($copath);
        die loc("path %1 is not a checkout path.\n", $copath) unless %$cinfo;
        ($repospath, $path, $repos) = $self->find_repos ($cinfo->{depotpath}, 1);
        my ($view_rev, $subpath);
        if (($view, $view_rev, $subpath) = $path =~ m{^/\^([\w/\-_]+)(?:\@(\d+)(.*))?$}) {
            ($path, $view) = SVK::Command->create_view ($repos, $view, $view_rev, $subpath);
        }
 
        $path = abs2rel ($copath, $coroot => $path, '/');
 
        ($depotpath) = $cinfo->{depotpath} =~ m|^/(.*?)/|;
        $rev = $cinfo->{revision} unless defined $rev;
        $depotpath = "/$depotpath$path";
    }
 
    from_native ($path, 'path', $self->{encoding});
    undef $@;
    my $ret = $self->create_path_object
        ( repos => $repos,



( run in 0.756 second using v1.01-cache-2.11-cpan-2b0bae70ee8 )