As discussed in the section called “Revisions”, a revision is a “snapshot” of the repository at a particular moment in time. But the thing that makes Subversion—or any other version control system—useful is not that it keeps all the versions of your files and directories over time. It's that you can actually do something with those older versions! And to do this sort of time travelling, you need a mechanism for identifying revision snapshots.
Revision numbers in Subversion are pretty straightforward—just monotonically increasing integers. When you create a new Subversion repository, it begins its life at revision 0 and each successive commit increases the revision number by one. Subversion doesn't try to hide these numbers—they are a part of the interface you have into the history of your versioned data. For example, after you perform a commit, the Subversion client informs you of the new revision number:
$ svn commit --message "Corrected number of cheese slices." Sending sandwich.txt Transmitting file data . Committed revision 3.
If at any point in the future you want to refer to that
revision, you can do so by specifying it as
3
. We'll discover some reasons why you might
want to do that later in this chapter.
The svn command-line client provides a
pair of options for specifying the revisions you wish to operate
on. The most common of these is the --revision
(-r
), which accepts as a parameter either a
single revision specifier (-r
), or a pair of them
separated by a colon (REV
-r
).
This latter format is used to describe a revision
range, useful for commands that compare two revision
snapshots or operate on every revision between two specified
extremes, inclusively.REV1
:REV2
Subversion 1.4 introduced a second option for specifying
revision ranges, the --change
(-c
) option. This is basically just a shortcut
for specifying a range of revisions whose boundaries are
sequential integers. In other words, using -c
is the same thing as
using REV
-r
.
And you can trivially reverse the implied range, too, by putting
a dash in front of the revision number, as in REV
-1:REV
-c
-
.REV