SVK

 view release on metacpan or  search on metacpan

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

=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

    }
    return;
}

package SVK::Command::Branch::move;
use base qw( 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

    );
}

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

        }

        $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

     '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

# END BPS TAGGED BLOCK }}}
package SVK::Command::Move;
use strict;
use SVK::Version;  our $VERSION = $SVK::VERSION;
use base qw( SVK::Command::Copy );
use SVK::Util qw ( abs2rel );
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

	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

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

# 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.336 second using v1.01-cache-2.11-cpan-496ff517765 )