Name
svnversion – Summarize the local revision(s) of a working
copy.
Synopsis
svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]
Description
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 if
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.
Options
Like svnserve,
svnversion has no subcommands, it only
has options.
--no-newline (-n)Omit the usual trailing newline from the output.
--committed (-c)Use the last-changed revisions rather than the
current (i.e., highest locally available) revisions.
--help (-h)Print a help summary.
--versionPrint the version of svnversion
and exit with no error.
Examples
If the working copy is all at the same revision (for
example, immediately after an update), then that revision is
printed out:
$ svnversion
4168
You can add TRAIL_URL to make
sure that the working copy is not switched from what you
expect. Note that the WC_PATH
is required in this command:
$ svnversion . /repos/svn/trunk
4168
For a mixed-revision working copy, the range of
revisions present is printed:
$ svnversion
4123:4168
If the working copy contains modifications, a trailing
"M" is added:
$ svnversion
4168M
If the working copy is switched, a trailing "S" is
added:
$ svnversion
4168S
Thus, here is a mixed-revision, switched working copy
containing some local modifications:
$ svnversion
4212:4168MS
If invoked on a directory that is not a working copy,
svnversion assumes it is an exported
working copy and prints "exported":
$ svnversion
exported
.
To submit comments, corrections, or other contributions to the text, please visit