NAME
SVK::Command - Base class and dispatcher for SVK commands
SYNOPSIS
use SVK::Command;
my $xd = SVK::XD->new ( ... );
my $cmd = 'checkout';
my @args = qw( file1 file2 );open my $outputfh, '>', 'svk.log' or die $!;
SVK::Command->invoke ($xd, $cmd, $outputfh, @args);
DESCRIPTION
This module resolves alias for commands and dispatches them, usually with the "invoke" method. If the command invocation is incorrect, usage information is displayed instead. MMEETTHHOODDSS Class Methodsinvoke ($xd, $cmd, $outputfh, @args)
Takes a SVK::XD object, the command name, the output scalar reference, and the arguments for the command. The command name is translated withthe %alias map.
On Win32, after @args is parsed for named options, the remaining positional arguments are expanded for shell globbing with "bsdglob".getopt ($argv, %opt)
Takes a arrayref of argv for run getopt for the command, withadditional %opt getopt options.
Instance Methods"SVK::Command->invoke" loads the corresponding class
"SVK::Command::$name", so that's the class you want to implement the
following methods in: options () Returns a hash where the keys are Getopt::Long specs and the values area string that will be the keys storing the parsed option in $self.
Subclasses should override this to add their own options. Defaults to an empty list. optrecursive Defines if the command needs the recursive flag and its default. The value will be stored in "recursive". parsearg (@args) This method is called with the remaining arguments after parsing named options with "options" above. It should use the "arg*" methods to return a list of parsed arguments for the command's "lock" and "run" method to process. Defaults to return a single "undef". lock (@parseargs) Calls the "lock*" methods to lock the SVK::XD object. The arguments will be what is returned from "parsearg". run (@parsedargs) Actually process the command. The arguments will be what is returned from "parsearg". Returned undef on success. Return a string message to notify the caller errors. Utility Methods Except for "argdepotname", all "arg*" methods below returns a SVK::Path object, which consists of a hash with the following keys: cinfo copath depotpath path repos repospath report targets The hashes are handy to pass to many other functions. argcondensed (@args) Argument is a number of checkout paths.argurimaybe ($arg, $nonewmirror)
Argument might be a URI or a depotpath. If it is a URI, try to find it at or under one of currently mirrored paths. If not found, prompts the user to mirror and sync it.argcomaybe ($arg, $nonewmirror)
Argument might be a checkout path or a depotpath. If argument is URI then handles it via "argurimaybe".argcopath ($arg)
Argument is a checkout path.argdepotpath ($arg)
Argument is a depotpath, including the slashes and depot name.argdepotroot ($arg)
Argument is a depot root, or a checkout path that needs to be resolved into a depot root.argdepotname ($arg)
Argument is a name of depot. such as '' or 'test' that is being used normally between two slashes.argpath ($arg)
Argument is a plain path in the filesystem.applyrevision($target)
Apply the given revision from command line to $target.
parserevlist ()Parse -c or -r to a list of [from, to] pairs.
locktarget ($target)
XXX Undocumentedlockcoroot ($target)
XXX Undocumentedbriefusage ($file)
Display an one-line brief usage of the command object. Optionally, a
file could be given to extract the usage from the POD. filename Return the filename for the command module.usage ($wantdetail)
Display usage. If $wantdetail is true, the "DESCRIPTION" section is
displayed as well. EErrrroorr HHaannddlliinngghandleerror ($error)
XXX Undocumentedaddhandler ($error, $handler)
XXX Undocumentedmsghandler ($error, $message)
XXX Undocumentedmsghandler ($error)
XXX Undocumentedcommand ($cmd, \%args)
Construct a command object of the $cmd subclass and return it.
The new object will share the "xd" from the calling command object;contents in %args is also assigned into the new object.
rebless ($cmd, \%args)
Like "command" above, but modifies the calling object instead of creating a new one. Useful for a command object to recast itself into another command class.runcommandrecursively($target, $code)
Traverse $target and and invoke $code with each node.
SEE ALSO
SVK, SVK::XD, "SVK::Command::*"
perl v5.8.8 2006-12-28 SVK::Command(3)