<<

NAME

Vcs.pm -- a simple abstraction for version control systems.

SYNOPSIS

Example using Vcs::Svn

  use Vcs::Svn;
  my $vcs = Vcs::Svn->new($project, "repo_url", "commit_db_file", \&_co_hook);

  sub _co_hook {
    my ($vcs, $revision_id, $work_dir) = @_;
    # do some post processing
 }

New Vcs Submodule

The provided default implementations may be overriden to provide specific behavior. In most cases it is sufficient to override the following abstract subroutines to provide a vcs-specific command:

  _checkout_cmd(revision_id, work_dir)

Returns the command to checkout revision_id to the working directory work_dir.

  _diff_cmd(rev1, rev2, path)

Returns the command to compute a diff between two revisions rev1 and rev2. The optional path path is relative to the working directory and used to diff between certain files or directories.

  _rev_date_cmd(rev)

Returns the date of the revision rev or undef if the revision doesn't exist.

  _get_parent_revisions()

TODO

DESCRIPTION

This module provides a simple abstraction for version control systems.

Available submodules

A Vcs object has to be instantiated with:

active-bugs csv

The BUGS_CSV_ACTIVE file has the structure: BUGS_CSV_BUGID, BUGS_CSV_COMMIT_BUGGY, BUGS_CSV_COMMIT_FIXED, BUGS_CSV_ISSUE_ID, BUGS_CSV_ISSUE_URL.

Example for Svn:

  1,2264,2266,983,https://sourceforge.net/p/jfreechart/bugs/983
  2,2240,2242,959,https://sourceforge.net/p/jfreechart/bugs/959

Example for Git: 1,a9e5c9f99bcc16d734251f682758004a3ecc3a1b,b40ac81d4a81736e2b7536b14db4ad070b598d2e,98,https://github.com/FasterXML/jackson-core/issues/98 2,098ece8564ed5d37f483c3bfb45be897ed8974cd,38d6e35d1f1a9b48193804925517500de8efee1f,105,https://github.com/FasterXML/jackson-core/issues/105

Object subroutines

  $vcs->lookup(vid)

Queries the commit database (BUGS_CSV_ACTIVE) and returns the revision_id for the given version id vid. Format of vid checked using Utils::check_vid(vid).

  $vcs->lookup_vid(revision_id)

Returns the version_id for the given revision id.

  $vcs->num_revision_pairs()

Returns the number of revision pairs in the BUGS_CSV_ACTIVE file.

  $project->get_bug_ids()

Returns an array of all bug ids in the BUGS_CSV_ACTIVE file.

  $vcs->B<contains_version_id> C<contains_version_id(vid)

Given a valid version id (vid), this subroutine returns true if vid exists in the BUGS_CSV_ACTIVE file and false otherwise. Format of vid checked using Utils::check_vid(vid). This subroutine dies if vid is invalid.

  $vcs->checkout_vid(vid, work_dir)

Performs a lookup of vid in the BUGS_CSV_ACTIVE file followed by a checkout of the corresponding revision with revision_id to work_dir. Format of vid checked using Utils::check_vid(vid).

Always performs a clean checkout, i.e., the working directory is deleted before the checkout, if it already exists.

  $vcs->diff(revision_id_1, revision_id_2 [, path])

Returns the diff between revision_id_1 and revision_id_2 or undef if the diff failed. The path argument is optional and can be used to compute a diff between certain files or directories. Note that path is relative to the working directory.

  $vcs->export_diff(revision_id_1, revision_id_2, out_file [, path])

Exports the diff between revision_id_1 and revision_id_2 to out_file. The path argument is optional and can be used to compute a diff between certain files or directories. Note that path is relative to the working directory.

  $vcs->apply_patch(work_dir, patch_file)

Applies the patch provided in patch_file to the working directory work_dir.

  _apply_cmd(work_dir, patch_file)

Returns the command to apply the patch (patch_file) to the working directory (work_dir). Since the file path of some patches needs to be stripped, this command tries a few dry-runs for the most likely settings before giving up.

  $vcs->rev_date(rev)

Returns the date for the revision rev.

<<