sub prepare()

in lib/ES/Source.pm [104:137]


sub prepare {
#===================================
    my $self   = shift;
    my $title  = shift;
    my $branch = shift;

    my $checkout = Path::Class::tempdir( DIR => $self->temp_dir );
    my %edit_urls = ();
    my $first_path = 0;
    my @alternatives;
    my %roots;

    # need to handle repo name here, not in Repo
    for my $source ( $self->_sources_for_branch($branch) ) {
        my $repo   = $source->{repo};
        my $prefix = $source->{prefix};
        my $path   = $source->{path};
        my $repo_branch = $source->{map_branches}->{$branch} || $branch;

        my $source_checkout = $repo->prepare( $title, $repo_branch, $path, $checkout, $prefix );
        $edit_urls{ $source_checkout->absolute } = $source->{private} ?
            '<disable>' : $repo->edit_url($repo_branch);
        $first_path = $source_checkout unless $first_path;
        if ( $source->{alternatives} ) {
            push @alternatives, {
                source_lang => $source->{alternatives}->{source_lang},
                alternative_lang => $source->{alternatives}->{alternative_lang},
                dir => $source_checkout->subdir( $source->{path} ),
            };
        }
        $roots{ $repo->name } = $source_checkout;
    }
    return ( $checkout, \%edit_urls, $first_path, \@alternatives, \%roots );
}