Provided by: libarch-perl_0.5.2-1_all
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, get_previous_revision, get_ancestry_logs, get_history_revision_descs, get_annotate_revision_descs, clear_cache, add, delete, mode, get_file_diff, make_log, 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. get_revision Returns the fully qualified tree revision. 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"). get_previous_revision [<revision>] Given the fully qualified revision name (defaulting to get_revision) return the previous namespace revision in this tree version. Return undef for the base-0 revision. Note, the version-0 revision argument is handled specially. get_ancestry_logs [%args] Return all ancestry revision logs (calculated from the tree). The first log in the returned arrayref corresponds to the current tree revision, the last log is normally the original import log. If the tree has certain logs pruned (such practice is not recommended), then such pruned log is not returned and this method tries its best to determine its ancestor, still without accessing the archive. %args accepts: flags no_continuation and one_version, and callback to filter a revision log before it is collected. If no_continuation is set, then do not follow tags backward. If one_version is set, then do not follow tags from the versions different than the initial version. This is similar to no_continuation, but not the same, since it is possible to tag into the same version. The default callback is effectivelly: sub { my ($log) = @_; return $log; } Note that if the callback does $_[0] = undef among other things, this is taken as a signal to stop processing of ancestry (the return value is still collected even in this case; return empty list to collect nothing). get_history_revision_descs [filepath [%args]] Return arrayref of all ancestry revision descriptions in the backward order (i.e. from a more recent to an older). 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. If filepath if given, then the revision description hash additionally contains keys filepath, orig_filepath (if renamed on that revision), is_filepath_added, is_filepath_renamed and is_filepath_modified. %args accepts: flags no_continuation and one_version, and callback to filter a revision description before it is collected. The default callback is effectivelly: sub { my ($revision_desc, $log) = @_; return $revision_desc; } The %args flags and assigning to $_[0] in callback have the same meaning as in get_ancestry_logs. get_annotate_revision_descs [filepath [%args]] Return file annotation data. In scalar context, returns arrayref of all ancestry revision descriptions in the backward order (i.e. from a more recent to an older) responsible for last modification of all file lines. In list context, returns list of 3 values: ($lines, $line_revision_desc_indexes, $revision_descs) = $tree->get_annotate_revision_descs($filename); $lines is arrayref that contains all filepath lines with no end-of-line; $line_revision_desc_indexes is arrayref of the same length that contains indexes to the $revision_descs arrayref. Note that $revision_descs is the same returned in the scalar context, it is similar to the one returned by get_history_revision_descs, but possibly contains less elements, since some revisions only modified metadata, or only modified lines that were modified by other revisions afterward, all such revisions are not included. If some lines can't be annotated (usually, because the history was cut), then the corresonding $line_revision_desc_indexes elements are undefined. %args accepts: flags no_continuation and one_version, and callback to filter a revision description before it is collected. The default callback is effectivelly: sub { my ($revision_desc, $log) = @_; return $revision_desc; } The %args flags and assigning to $_[0] in callback have the same meaning as in get_ancestry_logs and get_history_revision_descs. Additionally, prefetch_callback is supported. If given, it is called before fetching a changeset, with two arguments: revision, and filename to look at the patch of which. More %args keys are linenums (either string or arrayref or hashref), match_re (regular expression to filter lines). And flags highlight (syntax highlight lines using markup), full_history (include all file history revision even those that didn't add the current file lines). 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 }] files ... Add exlicit inventory ids for files. A specific inventory id may be passed via the options hash with the key "id". delete files ... Delete explicit inventory ids for files. move old_file new_file Move exlicit file id for old_file to new_file. get_file_diff file Get modifications for file as unified diff. make_log Create a new commit log, if it does not yet exist. Returns the filename. import [{ options }] [version] Similar to 'tla import'. commit [{ options }] [version] Commit changes in tree. Note, version argument is not supported in newer baz versions. Optional file limits may be passed using files arrayref in options.
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.