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 REV SRC-URL DST-URL

Copy the file or directory located at SRC-URL in revision REV to DST-URL.

mkdir URL

Create a new directory at URL. The parent directory of URL must 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-URL DST-URL

Move the file or directory located at SRC-URL to DST-URL.

rm URL

Delete the file or directory located at URL.

put SRC-FILE URL

Add a new file—or modify an existing one—located at URL, copying the contents of the local file SRC-FILE as the new contents of the created or modified file. As a special consideration, SRC-FILE may be - to instruct svnmucc to read from standard input rather than a local filesystem file.

propset NAME VALUE URL

Set the value of the property NAME on the target URL to VALUE.

propsetf NAME FILE URL

Set the value of the property NAME on the target URL to the contents of the file FILE.

propdel NAME URL

Delete the property NAME from the target URL.

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-dir DIR

Read configuration information from the specified directory instead of the default location (.subversion in the user's home directory).

--config-option CONFSPEC

Set, for the duration of the command, the value of a runtime configuration option. CONFSPEC is a string which specifies the configuration option namespace, name and value that you'd like to assign, formatted as FILE:SECTION:OPTION=[VALUE]. In this syntax, FILE and SECTION are the runtime configuration file (either config or servers) and the section thereof, respectively, which contain the option whose value you wish to change. OPTION is, of course, the option itself, and VALUE the 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) ARGFILE

Read additional would-be command-line arguments from ARGFILE, one argument per line. As a special consideration, ARGFILE may be - to indicate that additional arguments should be read instead from standard input.

--file (-F) MSGFILE

Use the contents of the MSGFILE as the log message for the commit.

--help (-h, -?)

Show program usage information and exit.

--message (-m) MSG

Use MSG as the log message for the commit.

--no-auth-cache

Prevent caching of authentication information (e.g., username and password) in the Subversion runtime configuration directories.

--non-interactive

Disable all interactive prompting (e.g., requests for authentication credentials).

--revision (-r) REV

Use revision REV as 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-URL

Use ROOT-URL as 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) PASSWD

Use PASSWD as the password when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.

--username NAME

Use USERNAME as the username when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.

--version

Display the program's version information and exit.

--with-revprop NAME=VALUE

Set the value of the revision property NAME to VALUE on 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.