svnmucc
Name
svnmucc — Perform one or more Subversion repository URL-based ACTIONs, committing the result as a (single) new revision.
Synopsis
svnmucc ACTION...
Description
svnmucc is a program for modifying
Subversion-versioned data without the use of a working copy.
It allows operations to be performed directly against the
repository URLs of the files and directories that the user
wishes to change. Each invocation of svnmucc
attempts one or more ACTIONs,
atomically committing the results of those combined
ACTIONs as a single new
revision.
Actions
svnmucc supports the following actions (and related arguments), which may be combined into ordered sequences on the command line:
- cp
REVSRC-URLDST-URL Copy the file or directory located at
SRC-URLin revisionREVtoDST-URL.- mkdir
URL Create a new directory at
URL. The parent directory ofURLmust already exist (or have been created by a prior svnmucc action), as this command does not offer the ability to automatically create any missing intermediate parent directories.- mv
SRC-URLDST-URL Move the file or directory located at
SRC-URLtoDST-URL.- rm
URL Delete the file or directory located at
URL.- put
SRC-FILEURL Add a new file—or modify an existing one—located at
URL, copying the contents of the local fileSRC-FILEas the new contents of the created or modified file. As a special consideration,SRC-FILEmay be-to instruct svnmucc to read from standard input rather than a local filesystem file.- propset
NAMEVALUEURL Set the value of the property
NAMEon the targetURLtoVALUE.- propsetf
NAMEFILEURL Set the value of the property
NAMEon the targetURLto the contents of the fileFILE.- propdel
NAMEURL Delete the property
NAMEfrom the targetURL.
Options
Options specified on the svnmucc command line are global to all actions performed by that command line. The following is a list of the options supported by this tool:
--config-dirDIRRead configuration information from the specified directory instead of the default location (
.subversionin the user's home directory).--config-optionCONFSPECSet, for the duration of the command, the value of a runtime configuration option.
CONFSPECis a string which specifies the configuration option namespace, name and value that you'd like to assign, formatted asFILE:SECTION:OPTION=[VALUE]. In this syntax,FILEandSECTIONare the runtime configuration file (eitherconfigorservers) and the section thereof, respectively, which contain the option whose value you wish to change.OPTIONis, of course, the option itself, andVALUEthe value (if any) you wish to assign to the option. For example, to temporarily disable the use of the compression in the HTTP protocol, use--config-option=servers:global:http-compression=no. You can use this option multiple times to change multiple option values simultaneously.--extra-args(-X)ARGFILERead additional would-be command-line arguments from
ARGFILE, one argument per line. As a special consideration,ARGFILEmay be-to indicate that additional arguments should be read instead from standard input.--file(-F)MSGFILEUse the contents of the
MSGFILEas the log message for the commit.--help(-h,-?)Show program usage information and exit.
--message(-m)MSGUse
MSGas the log message for the commit.--no-auth-cachePrevent caching of authentication information (e.g., username and password) in the Subversion runtime configuration directories.
--non-interactiveDisable all interactive prompting (e.g., requests for authentication credentials).
--revision(-r)REVUse revision
REVas the baseline revision for all changes made via the svnmucc actions. This is an important option which users should habituate to using whenever modifying existing versioned items to avoid inadvertently undoing contemporary changes made by fellow team members.--root-url(-U)ROOT-URLUse
ROOT-URLas a base URL to which all other URL targets are relative. This URL need not be the repository's root URL (such as might be reported by svn info). It can be any URL common to the various targets which are specified in the svnmucc actions.--password(-p)PASSWDUse
PASSWDas the password when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.--usernameNAMEUse
USERNAMEas the username when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.--versionDisplay the program's version information and exit.
--with-revpropNAME=VALUESet the value of the revision property
NAMEtoVALUEon the committed revision.
Examples
To (safely) modify a file's contents without using a working copy, use svn cat to fetch the current contents of the file, and svnmucc put to commit the edited contents thereof.
$ # Calculate some convenience variables.
$ export FILEURL=http://svn.example.com/projects/sandbox/README
$ export BASEREV=`svn info ${FILEURL} | \
grep '^Last Changed Rev' | cut -d ' ' -f 2`
$ # Get a copy of the file's current contents.
$ svn cat ${FILEURL}@${BASEREV} > /tmp/README.tmpfile
$ # Edit the (copied) file.
$ vi /tmp/README.tmpfile
$ # Commit the new content for our file.
$ svnmucc -r ${BASEREV} put README.tmpfile ${FILEURL} \
-m "Tweak the README file."
r24 committed by harry at 2013-01-21T16:21:23.100133Z
# Cleanup after ourselves.
$ rm /tmp/README.tmpfile
Apply a similar approach to change a file or directory property. Simply use svn propget and svnmucc propsetf instead of svn cat and svnmucc put, respectively.
$ # Calculate some convenience variables.
$ export PROJURL=http://svn.example.com/projects/sandbox
$ export BASEREV=`svn info ${PROJURL} | \
grep '^Last Changed Rev' | cut -d ' ' -f 2`
$ # Get a copy of the directory's "license" property value.
$ svn -r ${BASEREV} propget license ${PROJURL} > /tmp/prop.tmpfile
$ # Tweak the property.
$ vi /tmp/prop.tmpfile
$ # Commit the new property value.
$ svnmucc -r ${BASEREV} propsetf prop.tmpfile ${PROJURL} \
-m "Tweak the project directory 'license' property."
r25 committed by harry at 2013-01-21T16:24:11.375936Z
# Cleanup after ourselves.
$ rm /tmp/prop.tmpfile
Let's look now at some multi-operation examples.
To implement a “moving tag”, where a single tag name is recycled to point to different snapshots (for example, the current latest stable version) of a codebase, use svnmucc rm and svnmucc cp:
$ svnmucc -U http://svn.example.com/projects/doohickey \
rm tags/latest-stable \
cp HEAD trunk tags/latest-stable \
-m "Slide the 'latest-stable' tag forward."
r134 committed by harry at 2013-01-12T11:02:16.142536Z
$
In the previous example, we slyly introduced the use of
the --root-url (-U) option. Use this
option to specify a base URL to which all other operand URLs
are treated as relative (and save yourself some
typing).
The following shows an example of using svnmucc to, in a single revision, create a new tag of your project which includes a newly created descriptive file and which lacks a directory which shouldn't be included in, say, a release tarball.
$ echo "This is the 1.2.0 release." | \
svnmucc -U http://svn.example.com/projects/doohickey \
-m "Tag the 1.2.0 release." \
-- \
cp HEAD trunk tags/1.2.0 \
rm tags/1.2.0/developer-notes \
put - tags/1.2.0/README.tag
r164 committed by cmpilato at 2013-01-22T05:26:15.563327Z
$ svn log -c 164 -v http://svn.example.com/projects/doohickey
------------------------------------------------------------------------
r164 | cmpilato | 2013-01-22 00:26:15 -0500 (Tue, 22 Jan 2013) | 1 line
Changed paths:
A /tags/1.2.0 (from /trunk:163)
A /tags/1.2.0/README.tag
D /tags/1.2.0/developer-notes
Tag the 1.2.0 release.
$
The previous example demonstrates not only how to do
several different things in a single svnmucc
invocation, but also the use of standard input as the source
of new file contents. Note the presence of --
to indicate that no more options follow on the command line.
This is required so that the bare - used
in the svnmucc put action won't be
flagged as a malformed option indicator.