This documentation was written to describe the 1.7.x series of Apache™ Subversion®. If you are running a different version of Subversion, you are strongly encouraged to visit and instead consult the version of this documentation appropriate for your version of Subversion.


svnversion — Summarize the local revision(s) of a working copy.


svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]


svnversion is a program for summarizing the revision mixture of a working copy. The resultant revision number, or revision range, is written to standard output.

It's common to use this output in your build process when defining the version number of your program.

TRAIL_URL, if present, is the trailing portion of the URL used to determine whether WC_PATH itself is switched (detection of switches within WC_PATH does not rely on TRAIL_URL).

When WC_PATH is not defined, the current directory will be used as the working copy path. TRAIL_URL cannot be defined if WC_PATH is not explicitly given.


Like svnserve, svnversion has no subcommands—only options:

--no-newline (-n)

Omits the usual trailing newline from the output.

--committed (-c)

Uses the last-changed revisions rather than the current (i.e., highest locally available) revisions.

--help (-h)

Prints a help summary.

--quiet (-q)

Requests that the program print only essential information while performing an operation.


Prints the version of svnversion and exit with no error.


If the working copy is all at the same revision (e.g., immediately after an update), then that revision is printed out:

$ svnversion

You can add TRAIL_URL to make sure the working copy is not switched from what you expect. Note that the WC_PATH is required in this command:

$ svnversion . /var/svn/trunk

For a mixed-revision working copy, the range of revisions present is printed:

$ svnversion

If the working copy contains modifications, a trailing 'M' is added:

$ svnversion

If the working copy is switched, a trailing 'S' is added:

$ svnversion

svnversion will also inform you if the target working copy is sparsely populated (see the section called “Sparse Directories”) by attaching the 'P' code to its output:

$ svnversion

Thus, here is a mixed-revision, sparsely populated and switched working copy containing some local modifications:

$ svnversion