The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Arch::Tree - class representing Arch tree

SYNOPSIS

use Arch::Tree;
my $tree = Arch::Tree->new;  # assume the current dir

print map { "$_\n" } $tree->get_log_versions;

foreach my $log ($tree->get_logs) {
    print "-" x 80, "\n";
    print $log->standard_date, "\n";
    print $log->summary, "\n\n";
    print $log->body;
}

DESCRIPTION

This class represents the working tree concept in Arch and provides some useful methods.

METHODS

The following methods are available:

new, root, get_version, set_version, get_log_versions, add_log_version, get_log_revisions, get_log, get_logs, get_log_revision_descs, get_inventory, get_changes, get_changeset, get_merged_log_text, get_merged_revision_summaries, get_merged_revisions, get_missing_revisions, get_missing_revision_descs, iterate_ancestry_logs, get_ancestry_revision_descs, clear_cache, add, import, commit.

new [dir-name]

Construct the Arch::Tree object associated with the existing directory dir-name. The default is the current '.' directory.

root

Returns the project tree root.

get_version

Returns the fully qualified tree version.

set_version version

Changes the tree version to version.

get_log_versions

Returns all version names (including the main one and merged ones) for which logs are stored in the tree. In the scalar context returns arrayref.

add_log_version version

Add log version version to project tree.

get_log_revisions [version]

Returns all revision names of the given version (the default is the tree version) for which logs are stored in the tree. In the scalar context returns arrayref.

get_log revision

Return Arch::Log object corresponding to the tree log of the given revision.

get_logs [version]

Return Arch::Log objects corresponding to the tree logs of the given version. In the scalar context returns arrayref.

The default version is the tree version (see get_version). A special version name '*' may be used, in this case all logs in get_log_versions are returned. version may be arrayref as well with the similar results.

get_log_revision_descs [version]

Returns arrayref of log revision description hashes corresponding to version. The optional version argument may get the same values that are supported by get_logs.

get_inventory

Returns Arch::Inventory object for the project tree.

get_changes

Returns a list of uncommited changes in the project tree.

get_changeset dir

Creates an Arch::Changeset of the uncommited changes in the tree. The directory dir is used to store the changeset and must not already exist. It will not be automatically removed.

get_merged_log_text

This is just the output of "tla log-for-merge".

get_merged_revision_summaries

Returns hash (actually sorted array of pairs) or hashref in the scalar context. The pair is for every merged revision: full-name => summary.

get_merged_revisions

The list of all merged in (present in the changes) full revisions. In the scalar context returns arrayref.

get_missing_revisions [version]

The list of all missing revisions corresponding to version. In the scalar context returns arrayref.

The default version is the tree version (see get_version).

get_missing_revision_descs [version]

The hashref of all missing revision descriptions corresponding to version. The hash keys are revisions and the values are hashrefs with keys name, summary, creator, email, date, kind.

The default version is the tree version (see get_version).

iterate_ancestry_logs callback [no_continuation]

For each ancestry revision (calculated from tree logs), call callback that receives the Arch::Log object and should return some list content. The values returned by the callback are collected in one array and are returned as arrayref.

If no_continuation is set, then do not follow tags backward.

get_ancestry_revision_descs [filepath] [one_version]

The arrayref of all ancestry revision descriptions in the backward order. If filepath is given, then only revisions that modified the given file (or dir) are returned. The revision description is hashref with keys name, summary, creator, email, date, kind, filepath.

If one_version is set then stop to report revision descriptions from the versions different than the initial version. one_version flag is similar to no_continuation flag in another method, but not the same, since it is possible to tag into the same version.

clear_cache [key ..]

For performance reasons, some method results are cached (memoized in fact). Use this method to explicitly request this cache to be cleared.

By default all cached keys are cleared; key may be one of the strings 'missing_revision_descs', 'missing_revisions'.

add [{ options }] file ...

Similar to 'tla add'.

import [{ options }] [version]

Similar to 'tla import'.

commit [{ options }] [version]

Commit changes in tree.

BUGS

Awaiting for your reports.

AUTHORS

Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel).

Enno Cramer (uebergeek@web.de--2003/arch-perl--devel).

SEE ALSO

For more information, see tla, Arch::Log, Arch::Inventory, Arch::Changes, Arch::Util, Arch::Name.