Chia-liang Kao (高嘉良) > SVK-v2.0.1 > SVK::XD

Download:
SVK-v2.0.1.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  57
Open  12
View/Report Bugs
Source   Latest Release: SVK-v2.2.3

NAME ^

SVK::XD - svk depot and checkout handling.

SYNOPSIS ^

  use SVK::XD;
  $xd = SVK::XD->new (depotmap => { '' => '/path/to/repos'});

TERMINOLOGY ^

depot

A repository referred by a name. The default depot is '' (the empty string).

depotpath

A path referred by a depot name and the path inside the depot. For example, //foo/bar means /foo/bar in the default depot '', and /test/foo/bar means /foo/bar in the depot test.

copath

Checkout path. A path in the file system that has a checked out version of a certain depotpath.

CONSTRUCTOR ^

Options to new:

depotmap

A hash reference for depot name and repository path mapping.

checkout

A Data::Hierarchy object for checkout paths mapping.

giantlock

A filename for global locking. This file protects all read and write accesses to the statefile.

When SVK begins to execute any command, it attempt to get a write lock on this "giant lock" file. Once it gets the lock, it writes its PID to the file, reads in its statefile, and begins to execute the command. Executing the command consists of a "lock" phase and a "run" phase. During the lock phase, a command can do one of three things: request to keep the giant lock for the entire execution (for commands which modify large parts of the statefile), request to lock individual checkout paths, or not request a lock.

In the first case, the command sets the hold_giant field on the SVK::Command object (this should probably change to a real API), and the command does not release the giant lock until it is finished; it can rewrite the statefile at the end of its execution without waiting on the lock, since it already holds it.

In the second case, the command calls lock on the SVK::XD object one or more times; this places a "lock" entry inside the Data::Hierarchy object in the statefile next to each locked path, unless they are already locked by another process. Between its lock phase and its run phase, the statefile is written to disk (with the new lock entries) and the giant lock is dropped. After the run phase, SVK acquires the giant lock again, reads in the statefile, copies all entries from the paths that it has locked into the version it just read, clears the lock entries from the hierarchy, writes the statefile to disk, and drops the giant lock. Any changes to the hierarchy other than in the locked paths will be ignored.

In the third case, SVK just drops the giant lock after the lock phase and never tries to read or write the statefile again.

statefile

Filename for serializing SVK::XD object.

svkpath

Directory name of giantlock and statefile.

METHODS ^

Serialization and locking

load

Load the serialized SVK::XD data from statefile. Initialize $self if there's nothing to load. The giant lock is acquired when calling load.

store
store

Serialize $self to the statefile. If giant lock is still ours, overwrite the file directly. Otherwise load the file again and merge the paths we locked into the new state file. After store is called, giant is unlocked.

lock

Lock the given checkout path, store the state with the lock info to prevent other instances from modifying locked paths.

unlock

Unlock all the checkout paths that were locked by this instance.

giant_lock

Lock the statefile globally. All other instances need to wait for the lock before they can do anything.

giant_unlock

Release the giant lock.

Depot and path translation

find_repos

Given depotpath and an option about if the repository should be opened. Returns an array of repository path, the path inside repository, and the SVN::Repos object if caller wants the repository to be opened.

find_repos_from_co

Given the checkout path and an option about if the repository should be opened. Returns an array of repository path, the path inside repository, the absolute checkout path, the checkout info, and the SVN::Repos object if caller wants the repository to be opened.

find_repos_from_co_maybe

Like find_repos_from_co, but falls back to see if the given path is a depotpath. In that case, the checkout paths returned iwll be undef.

find_depotname

Checkout handling

auto_prop

Return a hash of properties that should attach to the file automatically when added.

depot_delta

Generate SVN::Delta::Editor calls to represent the changes between (oldroot, oldpath) and (newroot, newpath). oldpath is a array ref for anchor and target, newpath is just a string.

Options:

editor

The editor receiving delta calls.

no_textdelta

Don't generate text deltas in apply_textdelta calls.

no_recurse
notice_ancestry
checkout_delta

Generate SVN::Delta::Editor calls to represent the local changes made to the checked out revision.

Options:

delete_verbose

Generate delete_entry calls for sub-entries within deleted entry.

absent_verbose

Generate absent_* calls for sub-entries within absent entry.

unknown_verbose

generate cb_unknown calls for sub-entries within absent entry.

absent_ignore

Don't generate absent_* calls.

expand_copy

Mimic the behavior like SVN::Repos::dir_delta, lose copy information and treat all copied descendents as added too.

cb_ignored

Called for ignored items if defined.

cb_unchanged

Called for unchanged files if defined.

get_entry($copath)

Returns the Data::Hierarchy entry and the schedule of the entry.

get_fh

Returns a file handle with keyword translation and line-ending layers attached.

get_props

Returns the properties associated with a node. Properties schedule for commit are merged if $copath is given.

syntax highlighting: