# Subversion Tools and Contrib

The directories 'tools' and 'contrib' in the Subversion repository contain code that works with Subversion but that Subversion doesn't depend on for normal operations.

The files in 'tools' are maintained collectively by the Subversion project, and are under the same open source copyright as Subversion itself.

Code in contrib/ is open source, but may have a different license or copyright holder than Subversion itself. The Subversion project does not maintain these programs, but merely distributes them for our users' convenience.

The code is grouped into the following subdirectories:

- backup
- bdb
- cgi
- client-side
- dev
- diff
- hook-scripts
- po
- server-side
- xslt

## Index by keyword

- authz
  - authz_svn_group.py
  - svnauthz-validate.c
- backup
  - backup-recipe.sh
  - hot-backup.py
  - svn-backup-dumps.py
  - svn-fast-backup
- bash
  - bash_completion
- bdb
  - backup-recipe.sh
  - erase-all-text-data.py
  - hot-backup.py
  - svn-bdb-view.py
  - svn-obliterate.py
  - whatis-rep.py
- branch / tag
  - svncopy.pl
- cgi
  - mirror_dir_through_svn.cgi
  - tweak-log.cgi
- commandline tools
  - asvn
  - mucc.c
  - server-vsn.py
  - svn_update.pl
- diff
  - diff.c
  - diff3.c
  - diff4.c
  - diff-to-logmsg.vim
  - diffwrap.bat
  - diff3wrap.bat
  - showchange.pl
  - svn2cl.sh
  - svn_all_diffs.pl
- fsfs
  - svn-fast-backup
- graph
  - svn-graph.pl
- import
  - svn_load_dirs.pl
- log message
  - diff-to-logmsg.vim
  - showchange.pl
  - svn-log.pl
  - svn2cl.sh
  - svn2rss.py
- merge
  - svnmerge.py
  - svnmerge.sh
- mirror
  - mirror_dir_through_svn.cgi
  - svn-push.c
  - svnmirror.sh
- .po files
  - svn-po-status-report.sh
  - svn-po-status-run.sh
  - verify-po.py
- post-commit - email
  - commit-email.pl
  - commit-email.rb
  - mailer.py
- pre-commit - check
  - case-insensitive.py
  - check-case-insensitive.py
  - check-mime-type.pl
  - commit-access-control.pl
  - commit-block-joke.py
  - detect-merge-conflicts.sh
  - enforcer
  - log-police.py
  - pre-commit-check.py
  - svnperms.py
  - verify-po.py
- pre-lock - check
  - pre-lock-require-needs-lock.py
- property
  - svn_apply_autoprops.py
- searching
  - svn_export_empty_files.py
  - wcgrep
- vim
  - diff-to-logmsg.vim
  - svn.vim
- working copy
  - svn_apply_autoprops.py
  - svn-clean
  - svn-resolve
  - svn_update.pl
  - svn-viewdiff
  - wcgrep
- xslt
  - svnindex.xsl
- subversion development tools
  - check-license.py
  - contribulyze.py
  - datecheck.py
  - gcov.patch
  - getsigs.pl
  - gnuify-changelog.pl
  - graph-dav-servers.py
  - ff2csv.py
  - find-fix.py
  - run-queries.sh
  - lock-check.py
  - mlpatch.py
  - normalize-dump.py
  - po-merge.py
  - prebuild-cleanup.sh
  - random-commits.py
  - scramble-tree.py
  - stress.pl
  - svn-dev.el
  - svn-dev.vim
  - svn-merge-revs.py
  - trails.py
  - verify-history.py
  - warn-ignored-err.sh
  - which-error.py

## backup

### hot-backup.py (tools/backup)

Perform a "hot" backup of a Berkeley DB repository. (and clean old logfiles after backup completes.)

## bdb

### erase-all-text-data.py (tools/bdb)

Erases the text of every file in a BDB repository.

Related files: skel.py svnfs.py

### svn-bdb-view.py (tools/bdb)

A pretty-printer for subversion BDB repository databases.

Related files: skel.py svnfs.py

### whatis-rep.py (tools/bdb)

Print a description (including data, path, and revision) of the specified node reps in a Subversion filesystem. Walks as much of the reps table as necessary to locate the data (e.g. does a table scan).

Related files: skel.py svnfs.py

## cgi

### mirror_dir_through_svn.cgi (contrib/cgi)

This CGI script mirrors a source directory to a target directory using a Subversion repository as an intermediary. It's written as a CGI script so that remote users making changes to a WebDAV folder can tell the server to mirror the WebDAV folder contents to another directory on the system. See the example usage story below.

See also mirror_dir_through_svn.README

### tweak-log.cgi (contrib/cgi)

It sure would be nice to be able to change the log messages on committed revisions of the Subversion repository via the web. This is a quick attempt at making that happen.

## client-side

### asvn (contrib/client-side)

Archive SVN (asvn) will allow the recording of file types not normally handled by svn. Currently this includes devices, symlinks and file ownership/permissions.

### bash_completion (tools/client-side)

Programmable completion for the Subversion svn command under bash.

Related files: bash_completion_test

### diff-to-logmsg.vim (contrib/client-side)

Converts a 'diff -urp' to a log message skeleton.

### diff3wrap.bat (contrib/client-side)

Wrapper for running a diff3/merge program.

### diffwrap.bat (contrib/client-side)

Wrapper for running a diff program.

### mucc.c (contrib/client-side)

Multiple URL Command Client: Combine a list of mv, cp and rm commands on URLs into a single commit.

Related files: mucc-test.sh

### search-svnlog.pl (contrib/client-side)

Show log messages matching a certain pattern.

### server-vsn.py (tools/client-side)

Print a Subversion server's version number.

### showchange.pl (tools/client-side)

Show the log message and diff for a revision.

### svn-clean (contrib/client-side)

Wipes out unversioned files from SVN working copy.

### svn-graph.pl (tools/client-side)

Produce a GraphViz .dot graph for the branch history of a node.

### svn-log.pl (contrib/client-side)

Generate a nice log format for the Subversion repository.

### svn-push.c (contrib/client-side/svn-push)

Propagate changesets from one (networked) repository to a different (networked) repository.

### svn-resolve (contrib/client-side)

Resolve Subversion conflicts using FileMerge.

(FileMerge is a graphical diff tool in the Mac OS X Developer Tools.)

### svn-viewdiff (contrib/client-side)

GNU diff wrapper for FileMerge.

(FileMerge is a graphical diff tool in the Mac OS X Developer Tools.)

### svn.vim (contrib/client-side)

Vim syntax hilighting for SVN commit log message template.

### svn2cl.sh (contrib/client-side/svn2cl)

Front end shell script for svn2cl.xsl, calls xsltproc with the correct parameters.

See also README.

Related files: svn2cl.1 svn2cl.xsl svn2html.css svn2html.xsl

### svn_all_diffs.pl (contrib/client-side)

Perl script that gets the revisions that modified a specified file or directory and prints the output of `svn diff' on between all revisions that that modified the file or directory. Good for seeing what changed over time and for tracking down when a particular line in a file changed.

### svn_apply_autoprops.py (contrib/client-side)

This script reads the auto-properties defined in the $HOME/.subversion/config file and applies them recursively to all the files and directories in the current working copy.

### svn_export_empty_files.py (contrib/client-side)

Script to "export" from a Subversion repository a clean directory tree of empty files instead of the content contained in those files in the repository. The directory tree will also omit the .svn directories. This script was written to create a non-working working copy that can be crawled with find or find's locate utility to make it easier to find files.

### svn_load_dirs.pl (contrib/client-side)

This Perl script is designed to load a number of directories into Subversion. This is useful if you have a number of .zip's or tar.{Z,gz,bz2}'s for a particular package and want to load them into Subversion.

See also svn_load_dirs.README.

Related files: svn_load_dirs_property_table.example

### svn_update.pl (contrib/client-side)

Run svn update and force it to produce conflicts for all files which would be merged using diff3.

This is a workaround for issue 2048 which was fixed in r13383 and released in svn 1.2.0.

### svncopy.pl (contrib/client-side)

Utility script for copying with branching/tagging.

See also svncopy.README.

Related files: testsvncopy.pl

### svnmerge.py (contrib/client-side)

Merge tracking script.

See also svnmerge.README.

### svnmerge.sh (contrib/client-side)

Merge tracking script, predecessor of svnmerge.py.

### wcgrep (contrib/client-side)

Useful for greping in a subversion working copy. Essentially it behaves the same way your grep command does.

## dev

### check-license.py (tools/dev)

Check if a file has the proper license in it.

### contribulyze.py (tools/dev)

Some Subversion project log messages include parseable data to help track who's contributing what. This script collects that data.

### datecheck.py (tools/dev)

This is a debugging script to test date-ordering in an SVN repository.

### gcov.patch (tools/dev)

This patch can be used to generate a report showing what C source lines are executed when the testsuite is run.

### getsigs.pl (tools/dev)

Terribly ugly hack of a script to verify the signatures on the release tarballs and produce the list of who signed them in the format we use for the announcements.

### gnuify-changelog.pl (tools/dev)

A script to munge the output of 'svn log' into something approaching the style of a GNU ChangeLog.

### graph-dav-servers.py (tools/dev)

This was originally a quick hack to make a pretty picture of svn DAV servers.

### ff2csv.py (tools/dev/iz)

Transform find-fix.py output into Excellable csv.

### find-fix.py (tools/dev/iz)

Produce a find/fix report for Subversion's IZ database.

### run-queries.sh (tools/dev/iz)

Run some IssueZilla queries.

### lock-check.py (tools/dev)

Repository lock checker. Gets and exclusive lock on the provided repository, then runs db_stat to see if the lock counts have been reset to 0. If not, prints the timestamp of the run and a message about accumulation.

### mlpatch.py (tools/dev)

Very annoyingly, the http://svn.haxx.se/ subversion mailing list archives mangle inline patches, and provide no raw message download facility (other than for an entire month's email as an mbox). So, I wrote this script, to demangle them. It's not perfect, as it has to guess about whitespace, but it does an acceptable job.

### normalize-dump.py (tools/dev)

Reads a Subversion dumpfile from DUMPFILE (or, if not provided, from stdin) and normalizes the metadata contained therein, printing summarized and sorted information. This is useful for generating data about dumpfiles in a diffable fashion.

### po-merge.py (tools/dev)

Read a single translation entry from the file F and return a tuple with the comments, msgid and msgstr. The comments is returned as a list of lines which do not end in new-lines. The msgid and msgstr are strings, possibly with embedded newlines.

### prebuild-cleanup.sh (tools/dev)

Purify a system, to simulate building Subversion on a "clean" box.

### random-commits.py (tools/dev)

Using the FILELIST (see config below), a series of COUNT commits will be constructed, each changing up to MAXFILES files per commit. The commands will be sent to stdout (formatted as a shell script).

### scramble-tree.py (tools/dev)

Makes multiple random file changes to a directory tree, for testing.

### stress.pl (tools/dev)

A script that allows some simple testing of Subversion, in particular concurrent read, write and read-write access by the 'svn' client. It can also create working copy trees containing a large number of files and directories. All repository access is via the 'svnadmin' and 'svn' commands.

### svn-dev.el (tools/dev)

Emacs Lisp help for writing Subversion code. This file contains some elisp functions which could be helpful to employ while working on Subversion.

### svn-dev.vim (tools/dev)

This file sets vim up to use subversion's coding style. It can be applied on a per buffer basis with :source svn-dev.vim, or can be source from ~/.vimrc to apply settings to all files vim uses. For other variation try :help autocmd.

### svn-merge-revs.py (tools/dev)

This script is meant to ease the pain of merging and reviewing revision(s) on a release branch (although it can be used to merge and review revisions from any line of development to another).

### trails.py (tools/dev)

A program for analyzing Subversion trail usage statistics.

### verify-history.py (tools/dev)

This program is used to verify the FS history code.

### warn-ignored-err.sh (tools/dev)

Insert or remove the GCC attribute "warn_unused_result" on each function that returns a Subversion error, in the specified files or, by default, *.h and *.c in the ./subversion and ./tools trees.

### which-error.py (tools/dev)

Print semantic Subversion error code names mapped from their numeric error code values.

## diff

### diff.c (tools/diff)

A diff program using subversions diff functions.

### diff3.c (tools/diff)

A diff3 program using subversions diff functions.

### diff4.c (tools/diff)

A diff4 program using subversions diff functions.

## hook-scripts

### case-insensitive.py (contrib/hook-scripts)

A pre-commit hook to detect case-insensitive filename clashes.

This is *much* more efficient than check-case-insensitive.py but it does require Subversion 1.3.0 or later.

### check-case-insensitive.py (contrib/hook-scripts)

This script can be called from a pre-commit hook on either Windows or a Unix like operating system. It implements the checks required to ensure that the repository acts in a way which is compatible with a case preserving but case insensitive file system.

Superceded by case-insensitive.py for Subversion 1.3.0 and later.

### check-mime-type.pl (contrib/hook-scripts)

Check that every added file has the svn:mime-type property set and every added file with a mime-type matching text/* also has svn:eol-style set. If any file fails this test the user is sent a verbose error message suggesting solutions and the commit is aborted.

### commit-access-control.pl (tools/hook-scripts)

Uses the `svnlook' program to check if the user who submitted the commit has appropriate rights to perform the commit on all the modified files and directories using the permissions specified in the configuration file.

Related files: commit-access-control.cfg.example

### commit-block-joke.py (contrib/hook-scripts)

A funny pre-commit hook example.

### commit-email.pl (tools/hook-scripts)

Send a notification email describing either a commit or a revprop-change action on a Subversion repository.

Uses the `svnlook' program to send commit emails. Invoke it from `repository/hooks/post-commit'. Run the script with no arguments for usage.

### commit-email.rb (tools/hook-scripts)

Uses the Ruby/SWIG client bindings to query the repository about the changes made by a particular revision, and send corresponding change emails. The program takes command-line options for basic setup and to fine-tune its behavior.

### detect-merge-conflicts.sh (contrib/hook-scripts)

A pre-commit hook to detect changes that look like forgotten conflict markers.

### enforcer (contrib/hook-scripts/enforcer)

This is a pre-commit hook that allows you to more easily specify a variety of rules that govern what may be committed to your repository.

Related files: enforcer.conf

### log-police.py (tools/hook-scripts)

Ensures that log messages end with exactly one newline. Can also be run as a standalone script to fix up old revisions.

### mailer.py (tools/hook-scripts/mailer)

Uses the Python/SWIG bindings to directly query the repository about the changes made by a particular revision. The program uses a configuration file for basic setup and to fine-tune where changes are delivered. Compared to commit-email.pl, the output contains a bit more information about property changes, is smarter with binary files, and it streams its output into the mailer (to avoid in-memory buffering).

Related files: mailer.conf.example tests/

### pre-commit-check.py (contrib/hook-scripts)

A template for checks in a pre-commit hook.

### pre-lock-require-needs-lock.py (contrib/hook-scripts)

This script, intended for use as a Subversion pre-lock hook, verifies that the PATH that USER is attempting to lock has the svn:needs-lock property set on it, returning success iff it does.

### svn2rss.py (contrib/hook-scripts)

Generates a RSS 2.0 file containing commit information.

### svnperms.py (tools/hook-scripts)

Pre-commit hook that checks write permissions, similar to commit-access-control.pl, but uses a different syntax. Run 'svnperms.py -h' for usage.

Related files: svnperms.conf.example

### verify-po.py (tools/hook-scripts)

This is a pre-commit hook that checks whether the contents of PO files committed to the repository are encoded in UTF-8.

## po

### svn-po-status-report.sh (tools/po)

Subversion po file translation status report generator.

### svn-po-status-run.sh (tools/po)

Script for mailing status output from cronjobs.

## server-side

### authz_svn_group.py (contrib/server-side)

mod_python authorization handler for mod_authz_svn groups.

### backup-recipe.sh (contrib/server-side)

This shell script demonstrates a backup/restore recipe for live Subversion repositories, using a standard full+incrementals process.

### svn-backup-dumps.py (tools/server-side)

This script creates (incremental) dump files from a subversion repository on *IX. It is intended for use in cron jobs and post-commit hooks.

### svn-fast-backup (contrib/server-side)

Use rsync snapshots for very fast FSFS repository backup.

### svn-obliterate.py (contrib/server-side)

Whitewash the contents of a Subversion file and its successors.

### svnauthz-validate.c (tools/server-side)

Load and validate an authz file.

### svnmirror.sh (contrib/server-side)

Mirror subversion repositories. This script supports pushing or pulling the changes via ssh and svn tools.

## xslt

### svnindex.xsl (tools/xslt)

A sample XML transformation style sheet for displaying the Subversion directory listing that is generated by mod_dav_svn when the "SVNIndexXSLT" directive is used.

Related files: svnindex.css