App-SnerpVortex

 view release on metacpan or  search on metacpan

lib/SVN/Analysis.pm  view on Meta::CPAN


	my $sth_copy = $self->dbh()->prepare_cached("
		INSERT INTO copy (src_path, src_rev, kind, dst_path, dst_rev)
		VALUES (?, ?, ?, ?, ?)
	") or die $self->dbh()->errstr();

	$sth_copy->execute($src_path, $src_rev, $kind, $dst_path, $dst_rev) or die(
		$sth_copy->errstr()
	);

	# It would suck if the relocated path existed.
	confess "target path $dst_path exists at r$dst_rev" if (
		$self->_path_exists($dst_path, $dst_rev)
	);

	# Touch the directory where the copy is landing.
	$self->_touch_parent_directory($dst_path, $dst_rev);

	# If this is a file, we're done.
	return if $kind ne "dir";

	warn "copy: $src_path $src_rev > $dst_path $dst_rev" if (
		$self->verbose()
	);

	# Copy the source path and all the entire tree below.
	foreach my $path_to_copy ($self->_get_tree_paths($src_path, $src_rev)) {
		my $relocated_path = $path_to_copy;
		$relocated_path =~ s/^\Q$src_path\E(\/|$)/$dst_path$1/ or confess(
			"can't relocate $path_to_copy from $src_path to $dst_path"
		);

		warn "copy includes: $path_to_copy > $relocated_path" if $self->verbose();

		my $sth = $self->dbh()->prepare_cached("
			INSERT INTO dir (
				path, rev_first, rev_last, op_first, op_last,
				is_active, is_add, is_copy, is_modified,
				src_path, src_rev
			)
			VALUES (
				?, ?, ?, ?, ?,
				?, ?, ?, ?,
				?, ?
			)
		") or die $self->dbh()->errstr();

		my $is_add = ($path_to_copy eq $src_path) ? 1 : 0;

		$sth->execute(
			$relocated_path, $dst_rev, $dst_rev, "copy", "copy",
			1, $is_add, 1, 0,
			$path_to_copy, $src_rev,
		) or die $sth->errstr();
	}

	return;
}

sub consider_delete {
	my ($self, $path, $revision) = @_;



( run in 0.398 second using v1.01-cache-2.11-cpan-71847e10f99 )