SVK::XD(3)
πΈ NAME πΈ
okay bestie, welcome to the SVK::XD(3) page β fresh out of the User Contributed Perl Documentation collection β and it's literally all about svk depot and checkout handling. that's it. that's the whole vibe. π
β¨ SYNOPSIS β¨
here's the little summoning ritual, copy it exactly bestie:
use SVK::XD;
$xd = SVK::XD->new (depotmap => { '' => '/path/to/repos'});
π TERMINOLOGY π
okay vocab check, we're doing this before the code so nobody gets lost:
- depot β a repository that gets referred to by a name. the default depot is
''(yes, the empty string, she's mysterious like that). - depotpath β a path that's identified by a depot name plus the path inside the depot. so for example
//foo/barmeans/foo/barinside the default depot'', and/test/foo/barmeans/foo/barinside the depottest. iykyk π¦ - copath β checkout path. a path on your actual file system that has a checked out version of a certain depotpath. your local girlie. π
π CONSTRUCTOR π
the options you can hand to new, and yes we're going through every single one:
depotmapβ a hash reference mapping depot name β‘οΈ repository path. the matchmaker. π«Άcheckoutβ aData::Hierarchyobject that maps checkout paths.giantlockβ a filename used for global locking. this file is the bouncer protecting all read and write accesses to thestatefile. π¨
so here's the whole saga: when SVK begins to execute any command, it attempts to get a write lock on this "giant lock" file. once it gets that lock, it writes its PID into the file, reads in its statefile, and starts executing the command. executing the command has two phases, a lock phase and a run phase. and during the lock phase, a command can do one of three things:
- request to keep the giant lock for the entire execution β this is for commands that modify big chunks of the
statefile. - request to lock individual checkout paths.
- not request a lock at all. iconic, unbothered.
so in the first case, the command sets the hold_giant field on the SVK::Command object (and the page itself says this should probably change to a real API, so like, noted π), and the command does not release the giant lock until it's finished. it can rewrite the statefile at the end of its execution without waiting on the lock, because it's already holding it. main character energy, honestly.
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 right next to each locked path β unless they're already locked by another process, in which case, nope. between its lock phase and its run phase, the statefile gets written to disk (with those new lock entries) and the giant lock is dropped. then after the run phase, SVK acquires the giant lock again, reads in the statefile, copies all entries from the paths it has locked into the version it just read, clears the lock entries out of the hierarchy, writes the statefile to disk, and drops the giant lock. and heads up: 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. ghosted. π
statefileβ the filename used for serializing theSVK::XDobject.svkpathβ the directory name wheregiantlockandstatefilelive. π
π₯ METHODS π₯
π Serialization and locking π
loadβ loads the serializedSVK::XDdata from statefile. if there's nothing to load, it initializes$self. and the giant lock gets acquired when you callload. β¨store,storeβ (yes bestie, the page listsstoretwice, we do not question the icon) serialize$selfto the statefile. if the giant lock is still ours, it overwrites the file directly. otherwise it loads the file again and merges the paths we locked into the new state file. and oncestorehas been called, giant is unlocked. πlockβ locks the given checkout path and stores the state with the lock info, so other instances can't go modifying the locked paths. hands off. π«unlockβ unlocks all the checkout paths that were locked by this instance. releasing them back into the wild. π¦giant_lockβ locks the statefile globally. every other instance has to wait for the lock before it can do literally anything.giant_unlockβ releases the giant lock. bye bestie π
π Depot and path translation π
find_reposβ give it a depotpath and an option about whether the repository should be opened, and it returns an array of the repository path, the path inside the repository, and theSVN::Reposobject β but only if the caller actually wants the repository opened. πfind_repos_from_coβ give it the checkout path and an option about whether the repository should be opened, and it returns an array of the repository path, the path inside the repository, the absolute checkout path, the checkout info, and theSVN::Reposobject, again only if the caller wants it opened.find_repos_from_co_maybeβ same energy asfind_repos_from_co, but it falls back to checking whether the given path is a depotpath. and in that case, the checkout paths it returns will beundef. surprise! πfind_depotnameβ that's it. that's the entry. the source gives us no description, so we simply respect the mystery. π«‘
π§ create_path_object π§
creates and returns a brand new path object. and it can be any of: SVK::Path::Checkout, SVK::Path::View, or SVK::Path. pick your fighter. β
it takes a hash with arguments.
- if the
copath_anchorargument is defined, then SVK::Path::Checkout gets created, and the other arguments are used to build itssourcein SVK::Path::Checkout using this method. and if therevisionargument is not defined, then the checkout path it's based on is used. - if the
viewargument is defined, then SVK::Path::View gets created, and the other arguments are used to build itssourcein SVK::Path::Checkout using this method. - otherwise, SVK::Path gets created. simple as that.
and the depot can be passed as an SVK::Depot object in the depot argument, or by using the depotname, repospath and repos arguments. the object takes precedence. π
π Checkout handling π
auto_propβ returns a hash of the properties that should get attached to the file automatically when it's added. β¨depot_deltaβ generatesSVN::Delta::Editorcalls to represent the changes between(oldroot, oldpath)and(newroot, newpath). heads up:oldpathis an array ref for anchor and target, whilenewpathis just a string. options:editorβ the editor receiving the delta calls. π¬no_textdeltaβ don't generate text deltas inapply_textdeltacalls.no_recursenotice_ancestry
(the last two are just vibing there with no description, we list them with love π)
checkout_deltaβ generatesSVN::Delta::Editorcalls to represent the local changes made to the checked out revision. options:delete_verboseβ generate delete_entry calls for sub-entries inside a deleted entry.absent_verboseβ generate absent_* calls for sub-entries inside an absent entry.unknown_verboseβ generate cb_unknown calls for sub-entries inside an absent entry.absent_ignoreβ don't generate absent_* calls. πexpand_copyβ mimic the behavior of SVN::Repos::dir_delta: lose the 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 that entry. πget_fhβ returns a file handle with keyword translation and line-ending layers attached.get_propsβ returns the properties associated with a node. and if$copathis given, the properties scheduled for commit get merged in too. π
and that's the whole page bestie, every flag, every argument, every default, no skips, no cap. π«Ά
perl v5.42.0 β¨ 2025-07-25 β mwah, go forth and handle those depots, you ate π π
π¦ where this page comes from
- fedora 43: perl-SVK 2.2.3-45.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms