- s4
- SVN::S4
- SVN::S4::CatOrMods
- SVN::S4::Config
- SVN::S4::Debug
- SVN::S4::FixProp
- SVN::S4::Getopt
- SVN::S4::Info
- SVN::S4::Path
- SVN::S4::QuickCommit
- SVN::S4::Scrub
- SVN::S4::Snapshot
- SVN::S4::Update
- SVN::S4::ViewSpec
- SVN::S4::WorkProp
s4
NAME
s4 - Wrapper for subversion program
SYNOPSIS
s4 help
s4 <any svn command>
i.e.: s4 add <file>
s4 delete <file>
s4 diff <file>
DESCRIPTION
S4 provides a wrapper to subversion that extends several of the commands. It understands all svn commands; you may simply use "s4" whereever you would normally type "svn".
In many cases, S4 simply runs "svn" with the same arguments as you passed to s4. If you want s4 to run a particular version of svn, you can either set the environment variable S4_SVN to the name of the subversion binary, or use --svn=SVN_BINARY to override the default.
COMMANDS
Any command not listed here is passed directly to subversion.
add
Perform normal subversion add, then if the add-fixprop configuration option is set, do a "s4 fixprop" on all of the new files.
With --no-fixprop, ignore the config setting and run the normal svn add, do not fixprop. With --fixprop, ignore the config setting and fixprop.
cat-or-mods
Perform a "svn cat HEAD" if the file has no modifications, else show the local file with modifications. This is a convient way of editing what would otherwise need to be a global file. If the file is unchanged you'll get HEAD (basically a global file), but you can also edit it locally to make changes.
checkout
s4 checkout behaves exactly the same way as svn checkout, unless the top directory that you check out contains a file called Project.viewspec. If Project.viewspec is present, s4 does the following steps instead.
1. Check out/update the top directory with --non-recursive, so that subdirectories are not fetched.
2. Parse the Project.viewspec file to see how the working area should be laid out. Project.viewspec specifies which directories in your working area should be mapped to which URLs in the repository. If any problems are found during viewspec parsing, s4 ends with an error.
3. Do a series of "svn switch" commands to build the working area. In normal svn, you cannot switch a directory unless it is already in the working copy, and checked in. S4 works around this (see SVN::S4::ViewSpec.pm if you must know), so the viewspec can put any directory at any location.
fixprop
Processes all files and directories passed as arguments.
* Any .cvsignore or .gitignore files will be read and set their directory's svn:ignore property. (See below for the format of .cvsignore or .gitignore).
* Any non-binary file which contains a CVS metacomment, and which do not have a svn:keyword property will have the svn:keyword property added.
* Any tsvn:autoprops property on a parent directory will be applied to all files that have no property of the same name already set.
With -N or --non-recursive, don't recurse across directories.
With --personal, only change files the current user has added, or was the last author of.
help subcommand
Invokes subversion help. With a subcommand modified or specific to s4, also prints s4 help on that command.
help-summary
Prints a summary of all Subversion and S4 commands.
info-switches path
Given a working file path, prints a non-recursive "svn info" at the path specified, plus every switch point under the path. Given an URL prints the info on any views underneath that URL.
merge
s4 merge behaves exactly the same way as svn merge, unless the top directory that you update contains a file called Project.viewspec. If Project.viewspec is present, s4 will print an error message. Merging is not supported in s4 views, as SVN creates many extranious svn:mergeinfo properties. Instead you should checkout a non-viewed area, and merge there.
quick-commit|qci PATH...
s4 quick-commit, or "qci" for short, performs a commit of the current tree. Unlike the normal commit command, qci will not create lock files, and so may be significantly faster on large trees. It is semantically equivelent to doing a svn status, then only commiting the files listed as changing rather then committing the entire tree.
scrub [--revision REV] [--url URL] PATH
s4 scrub turns a "used" source tree into a pristine one, as efficiently as it can.
WARNING: That means that it will permanently throw away all the changes you've made in your working copy. Is that really what you want? If not, stop right here.
It first does a "svn status" to look for any files that aren't checked in, anything that has been added but not checked in, etc. and erases/reverts them all. Then it updates the tree to the specified revision. When it's done, your tree should look exactly like a clean checkout. (If not it's a bug.)
You probably ask, why not just do "svn revert -R" or "svn update -r". Those commands tend to leave some junk behind, or sometimes they get jammed (e.g. object of the same name already exists). Also svn is understandably very conservative about erasing a file or directory that it is not SURE is checked in already. But this command is not; it's happy to blow away the changes in your working copy...in fact that's its primary job.
snapshot
s4 snapshot generates a compact patch file that describes how to reproduce a svn working copy exactly, including: - modified files (text or binary) - files and dirs that are not yet checked in - inconsistent svn revision numbers throughout the tree - property changes on files and dirs - svn switched files and directories - svn externals
The output of the s4 snapshot command is Bourne shell script that contains commands to create a new working copy or modify an existing one, run some svn commands, and apply all your changes. It is sort of like a "super-patch." When the script is done, the new working should match the original in every respect. If anything prevents such a patch from being created, it will die with an error. For example, if your working copy has deleted files or directories, or other unhealthy things, the snapshot code may not know how to recreate it so it will refuse to make a patch.
Snapshots can be useful for backing up your work (without having to check in), for bug reporting, or any time you want to "save your state" so that you can recreate your area later, or in another place.
Changes in text files appear in svn diff format. Changes in binary files are TARred, base64 encoded, and the encoded text appears in the patch file. I keep calling the output file a "patch" because in fact it can be used with the patch program. But it's also a shell script that recreates the svn state as well.
Example of making a snapshot and restoring: s4 checkout -r22100 http://svn.collab.net/repos/svn/trunk/www svnwebsite cd svnwebsite # add some files, modify some files, svn update to other revisions s4 rm images cp index.html myindex.html s4 add myindex.html echo Finish my new favorite feature >> roadmap.html echo as soon as possible >> roadmap.html s4 snap > /tmp/snapshot # The snapshot is a script to recreate these changes. # Let's run it. s4 revert -R . ; rm -f myindex.html # make it clean again bash /tmp/snapshot
update
s4 update behaves exactly the same way as svn checkout, unless the top directory that you update contains a file called Project.viewspec. If Project.viewspec is present, s4 does the steps described in the "checkout" section above.
In most updates, the viewspec file has not changed drastically, so there is no need to redo the svn switches, and s4 will do svn update. But if the tree structure changes, s4 will redo the switch commands.
workpropdel propname
s4 workpropdel deletes a work-area property of the given name, if it exists.
workpropget propname
s4 workpropget returns a work-area property of the given name, if it exists, otherwise "".
workproplist [--xml]
s4 workproplist lists all work area properties, with their values.
workpropset propname propvalue
s4 workpropset sets a work-area property of the given name to the given value. Work area properties are associated and unique to a given work area, and stored in the top level .svn directory.
ARGUMENTS
- --help
-
Displays this message and program version and exits.
- --orig
-
Pass all commands through to the original version of svn. Useful when svn has been aliased to a different command.
- --svn name
-
Name of svn executable, or "svn" if not specified. See also S4_SVN.
- --version
-
Displays program version and exits.
VIEWSPEC FILES
A viewspec file is a text file containing a series of one-line commands. Anything after a # character is considered a comment. Whitespace and blank lines are ignored. The commands must be one of:
- set VAR VALUE
-
Set environment variable VAR to VALUE. This is useful for making abbreviations to be used within the viewspec file, for frequently typed things such as the name of the svn repository.
- include FILE
-
Read another file that contains viewspec commands. If the filename does not begin with a slash, it is considered to be relative to the directory containing the Project.viewspec.
- include URL
-
Read a file out of the SVN repository that contains viewspec commands.
- view URL DIR
-
Directory DIR will be svn switched to URL.
- view URL/(.*) DIR$1
-
Directory DIR will be svn switched to URL. URL may contain a parenthesized regexp, which indicates the repository should be searched for matching files/subdirectories with the matching name. If found, $1 will be substituted into DIR. The URL parenthesis must follow all /s, that is they can only match against the final path component, not a mid-level part of the path.
- view URL DIR rev REVNUM
-
Directory DIR will be svn switched to URL at revision REVNUM. Note that this is not "sticky" the way CVS was. Svn updates will override the revision number, while s4 update will not.
REVNUM can also be a date in normal subversion format, as listed here: http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.tour.revs.dates Example: view URL DIR rev {2006-07-01}
- view URL@REVNUM DIR
-
Alternative form of revision pegging. This form must have a numeric revision.
- unview DIR
-
Ignore any view/unview commands that came above, for directories that begin with DIR, which may be a Perl regular expression. (The regexp must match everything from the beginning up through the end of the directory name.) This may be useful if you have included a viewspec and want to override some of its view commands.
FILES
- .cvsignore, .gitignore
-
Used by the fixprop command to specify the contents for the svn:ignore property.
The contents "[recursive]" indicates that everything following that tag until the end of the file should be applied to all directories underneath this one.
- .svn/workprops
-
S4 workprop* commands store the work area properties in a workprops file in the highest .svn directory. This file is in YAML format.
CONFIG FILES
The following svn config file options are added by s4.
- [s4] add-fixprop = yes
-
If yes, an "add" command will also do a fixprop. Note this defaulted to true prior to version 1.041.
- [s4] co-under-co = no
-
If no, a "checkout" command will not be allowed when inside an existing checkout.
ENVIRONMENT
- RSVN_CALLING_SSH
-
Set by this script to 1. See
rsvnfor details. - S4_CONFIG
-
Filename of additional configuration options. Processed after the /etc/subversion/config and ~/.subversion/config files.
- S4_SVN
-
Name of svn executable, or "svn" if not specified.
BUGS
DISTRIBUTION
The latest version is available from CPAN and from http://www.veripool.org/.
Copyright 2005-2011 by Bryce Denney and Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
AUTHORS
Bryce Denney <bryce.denney@sicortex.com> and Wilson Snyder <wsnyder@wsnyder.org>
SEE ALSO
svn, SVN::S4,
rsvn package, which provides rs4 to run s4 on NFS servers.
SVN::S4
NAME
SVN::S4 - Wrapper for Subversion
SYNOPSIS
use SVN::S4;
DESCRIPTION
SVN::S4 is a derived class of SVN::Client. The various SVN::S4::... classes add member functions to this class to perform various functions.
METHODS
- $self->client
-
Return the SVN::Client object.
- $self->propget_string(filename=>file, propname=>prop)
-
Return the string value of the property, or undef if not set or bad file.
- $self->propset_string(filename=>file, propname=>prop, propval=>val)
-
Set the string value of the property.
- new (params)
-
Create a new SVN::S4 object.
SEE ALSO
svn, s4
SVN::Client, SVN::S4::FixProp, SVN::S4::Getopt, SVN::S4::Info, SVN::S4::Path, SVN::S4::QuickCommit, SVN::S4::Scrub, SVN::S4::Snapshot, SVN::S4::Update, SVN::S4::ViewSpec
SVN::S4::CatOrMods
NAME
SVN::S4::CatOrMods - Fix svn:ignore and svn:keywords properties
SYNOPSIS
Shell: s4 fixprop {files_or_directories}
Scripts: use SVN::S4::CatOrMods; $svns4_object->fixprop(filename=>filename);
DESCRIPTION
SVN::S4::CatOrMods provides utilities for changing properties on a file-by-file basis.
METHODS
None.
METHODS ADDED TO SVN::S4
The following methods extend to the global SVN::S4 class.
- $s4->cat_or_mods
-
Cat or show modifications for the specified file.
SEE ALSO
SVN::S4::Config
NAME
SVN::S4::Config - Get subversion config values
SYNOPSIS
Scripts: use SVN::S4; # See below
DESCRIPTION
SVN::S4::Config reads the user .subversion config files.
METHODS ADDED TO SVN::S4
The following methods extend to the global SVN::S4 class.
- $s4->config_get(<section>,<key>)
-
Return the config value for the given section and key.
SEE ALSO
SVN::S4::Debug
NAME
SVN::S4::Debug - Allow debug messages to be easily switched on and off.
SYNOPSIS
use SVN::S4::Debug qw(INFO DEBUG is_debug);
INFO ("informational message");
DEBUG ("debug message") if is_debug>=2;
DESCRIPTION
SVN::S4::Debug functions are used instead of print, to allow control over all log messages work in a unified way.
Debug levels can be controlled globally, or via a per-package $Debug variable that is created automatically. (However, it's more general to test the is_debug method in scripts, unless it is a very hot function.)
Conventions for inside BugVise (but not required by this module) are that debug level 1 is for high-level messages for program debug. Levels 2 and above are for package debug, 2 being common, and above 2 being very verbose.
METHODS
- INFO
-
Print an informational message.
- DEBUG
-
Print a debug message.
- debug_option switch
-
Enable debug on all modules, based on the command line argument passed. This is typically called from a Getopt::Long parser. Options supported are: "--debug" will set debug level 1 globally, and "--debugi {level}" will set the global debug level to the specified value. "--debugi {package}:{level}" to set debug on one package, and will also work on any package that uses a $Debug variable.
- global_debug level
-
Enable debug on all modules.
- is_debug
-
Return current debug level, or zero if not enabled.
- package_debug level
-
Enable debug on the current package.
- show_deltas flag
-
If true, print timestamps as relative to the last printout.
ENVIRONMENT
- BUGVISE_DEBUG
-
If set, parse the contents of BUGVISE_DEBUG as a
debug_option()at package start time.
SEE ALSO
Log::Log4perl
SVN::S4::FixProp
NAME
SVN::S4::FixProp - Fix svn:ignore and svn:keywords properties
SYNOPSIS
Shell: s4 fixprop {files_or_directories}
Scripts: use SVN::S4::FixProp; $svns4_object->fixprop(filename=>filename);
DESCRIPTION
SVN::S4::FixProp provides utilities for changing properties on a file-by-file basis.
METHODS
- file_has_keywords(filename)
-
Return true if the filename contains a SVN metacomment.
- skip_filename(filename)
-
Return true if the filename has a name which shouldn't be recursed on.
METHODS ADDED TO SVN::S4
The following methods extend to the global SVN::S4 class.
- $s4->fixprops
-
Recurse the specified files, searching for .cvsignore, .gitignore or keywords that need repair.
SEE ALSO
SVN::S4::Getopt
NAME
SVN::S4::Getopt - Get Subversion command line options
SYNOPSIS
use SVN::S4::Getopt; my $opt = new SVN::S4::Getopt; ... =head1 DESCRIPTION
The SVN::S4::Getopt package provides standardized handling of global options for the front of svn commands.
- $opt = SVN::S4::Getopt->new ( opts )
-
Create a new Getopt.
ACCESSORS
There is a accessor for each parameter listed above. In addition:
- $self->
commands_sorted() -
Return sorted list of all commands.
- $self->command_arg_text(<cmd>)
-
Return textual description of the specified command.
- $self->command_s4_addition(<cmd>)
-
Return true if the command is only in s4.
- $self->command_s4_changed(<cmd>)
-
Return true if the command is modified from normal SVN operation by s4.
- $self->
fileline() -
The filename and line number last parsed.
- $self->formCmd(<cmd>, <opts>)
-
Return an array of command arguments needed to specify the given command with hash of given options. Hash elements with unsupported options are silently ignored.
- $self->hashCmd(<cmd>, <opts>)
-
Return a hash with one key for each option. The value of the key is 1 if a no-argument option was set, else it is an array with each value the option was set to.
- $self->parseCmd(<cmd>, <opts>)
-
Return a array with one element for each option. The element is either 'switch', the name of the switch the option is specifying, or the name of the parameter.
- $self->stripOneArg(-<arg>, <opts>...)
-
Return the option list, with the specified matching argument removed.
SEE ALSO
SVN::S4::Info
NAME
SVN::S4::Info - Enhanced update and checkout methods
SYNOPSIS
Shell: s4 info-switches PATH URL
Scripts: use SVN::S4::Info; $svns4_object->info_switches
DESCRIPTION
SVN::S4::Info
METHODS
- info_switches
-
Perform a svn info on all of the switchpoints plus the trunk.
SEE ALSO
SVN::S4::Path
NAME
SVN::S4::Path - File path and parsing utilities
SYNOPSIS
my $file = fileNoLinks($filename)
DESCRIPTION
This module provides operations on files and paths.
METHODS
fileNoLinks($filename)-
Resolve any symlinks in the given filename.
isURL($filename)-
Return true if the filename is a absolute URL file name.
wholefile($filename)-
Return contents of the file as a string, or undef if does not exist.
SEE ALSO
SVN::S4::QuickCommit
NAME
SVN::S4::QuickCommit - commit only changed files
SYNOPSIS
Scripts: use SVN::S4::QuickCommit; $svns4_object->quick_commit (paths=>path);
DESCRIPTION
SVN::S4::QuickCommit
METHODS
SEE ALSO
SVN::S4::Scrub
NAME
SVN::S4::Scrub - make working copy completely clean again
SYNOPSIS
Scripts: use SVN::S4::Scrub; $svns4_object->scrub (path=>path);
DESCRIPTION
SVN::S4::Scrub
METHODS
SEE ALSO
SVN::S4::Snapshot
NAME
SVN::S4::Snapshot - create complete snapshot of working copy
SYNOPSIS
Scripts: use SVN::S4::Snapshot; $svns4_object->snapshot (path=>path);
DESCRIPTION
SVN::S4::Snapshot
METHODS
SEE ALSO
SVN::S4::Update
NAME
SVN::S4::Update - Enhanced update and checkout methods
SYNOPSIS
Shell: s4 update PATH URL s4 checkout PATH URL
Scripts: use SVN::S4::Update; $svns4_object->update $svns4_object->checkout
DESCRIPTION
SVN::S4::Update
METHODS
- TBD
-
TBD
SEE ALSO
SVN::S4::ViewSpec
NAME
SVN::S4::ViewSpec - behaviors related to viewspecs
SYNOPSIS
Scripts: use SVN::S4::ViewSpec; $svns4_object->parse_viewspec(filename=>filename, revision=>revision); $svns4_object->apply_viewspec(filename=>filename);
DESCRIPTION
SVN::S4::ViewSpec implements parsing viewspec files and performing the svn updates and svn switches required to make your working copy match the viewspec file.
For viewspec documentation, see s4.
METHODS
- $s4->parse_viewspec(parse_viewspec(filename=>filename, revision=>revision);
-
Parse_viewspec reads the file specified by FILENAME, and builds up a list of svn actions that are required to build the working area.
The revision parameter is used as the default revision number for all svn operations, unless the viewspec file has a "rev NUM" clause that overrides the default.
- $s4->apply_viewspec
-
For each of the svn actions, perform the actions. An example of an action is to run svn switch on the Foo directory the the URL Bar at revision 50.
SEE ALSO
SVN::S4::WorkProp
NAME
SVN::S4::WorkProp - Work area properties
SYNOPSIS
Shell: s4 workpropdel PROPNAME s4 workpropget PROPNAME s4 workproplist [-v --xml] s4 workpropset PROPNAME PROPVAL
Scripts: use SVN::S4; # See below
DESCRIPTION
SVN::S4::WorkProp provides utilities for work area properties.
METHODS
- workpropdel(name=>name)
-
Delete the property.
- workpropget(name=>name, print=>1)
-
Return or print value of given property.
- workpropset(name=>name, value=>value)
-
Set the property.
- workproplist(verbose=>1, xml=>1)
-
Return value of given property.
METHODS ADDED TO SVN::S4
The following methods extend to the global SVN::S4 class.
- $s4->fixprops
-
Recurse the specified files, searching for .cvsignore, .gitignore or keywords that need repair.
![[logo]](/img/veripool_small.png)