|
Version Control with Subversion - Revisions: Numbers, Keywords, and Dates, Oh My! - Revision Keywords
Revision Keywords
The Subversion client understands a number of
revision keywords. These keywords
can be used instead of integer arguments to the
--revision switch, and are resolved into
specific revision numbers by Subversion:
Note
Each directory in your working copy contains an
administrative subdirectory called
.svn . For every file in a directory,
Subversion keeps a copy of each file in the administrative
area. This copy is an unmodified (no keyword expansion, no
end-of-line translation, no nothing) copy of the file as it
existed in the last revision (called the “BASE”
revision) that you updated it to in your working copy. We
refer to this file as the pristine
copy or text-base version
of your file, and it's always an exact byte-for-byte copy of
the file as it exists in the repository.
-
HEAD
-
The latest (or “youngest”) revision in
the repository.
-
BASE
-
The revision number of an item in a working copy.
If the item has been locally modified, the “BASE
version” refers to the way the item appears
without those local modifications.
-
COMMITTED
-
The most recent revision prior to, or equal to,
BASE , in which an item changed.
-
PREV
-
The revision immediately
before
the last revision in which an item changed.
(Technically, COMMITTED - 1.)
Note
PREV , BASE , and
COMMITTED can be used to refer to local
paths, but not to URLs.
Here are some examples of revision keywords in action.
Don't worry if the commands don't make sense yet; we'll be
explaining these commands as we go through the chapter:
$ svn diff --revision PREV:COMMITTED foo.c
# shows the last change committed to foo.c
$ svn log --revision HEAD
# shows log message for the latest repository commit
$ svn diff --revision HEAD
# compares your working file (with local changes) to the latest version
# in the repository
$ svn diff --revision BASE:HEAD foo.c
# compares your “pristine” foo.c (no local changes) with the
# latest version in the repository
$ svn log --revision BASE:HEAD
# shows all commit logs since you last updated
$ svn update --revision PREV foo.c
# rewinds the last change on foo.c
# (foo.c's working revision is decreased)
These keywords allow you to perform many common (and
helpful) operations without having to look up specific
revision numbers or remember the exact revision of your
working copy.
[an error occurred while processing this directive]
|
|