SVK
view release on metacpan or search on metacpan
lib/SVK/Command.pm view on Meta::CPAN
820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853=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
379380381382383384385386387388389390391392393394395396397398399
}
return
;
}
package
SVK::Command::Branch::move;
use
base
qw( https://metacpan.org/pod/SVK::Command::Move">SVK::Command::Move SVK::Command::Smerge SVK::Command::Delete SVK::Command::Branch::create )
;
use
SVK::I18N;
use
SVK::Logger;
use
Path::Class;
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
81828384858687888990919293949596979899100101
);
}
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
107108109110111112113114115116117118119120121122123124125126127
}
$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
626364656667686970717273747576777879808182
'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
505152535455565758596061626364656667686970# END BPS TAGGED BLOCK }}}
package
SVK::Command::Move;
use
strict;
use
SVK::I18N;
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
108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
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
483484485486487488489490491492493494495496497498499500501502503504505506C<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
568569570571572573574575576577578579580581582583584585586587588589590591592593594595596# 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 )