Page 145 -
P. 145
TABLE 7-1. cookies.txt r23 as it looked on March 4
2 1/4 cups flour 1 tsp baking soda 1/2 tsp salt
1 cup butter 3/4 cup sugar 3/4 cup brown sugar
1 tsp vanilla 2 eggs 2 cups chocolate chips
Mix butter and sugars. Beat until creamy. Add vanilla. Beat in
eggs, one at a time. Mix in rest of ingredients. Drop by
spoonfuls on cookie sheets. Bake at 350 degrees.
Subversion uses global revision numbers, which means that the revision number applies
to the entire tree in the repository. Any time that a change is made to any file in the repos-
itory, the global revision number of the repository is incremented. Table 7-1 shows a file
as it looked on March 4, when the repository was at Revision 23. Some people may refer
to this as “Revision 23 of cookies.txt,” but what they really mean is “cookies.txt as it appeared
in Revision 23 of the repository.” If someone updates a different file in the repository on
March 5, the repository’s revision number will increment to 24. When that happens, there
is now an r24 of cookies.txt—it just happens to be identical to r23.
Now, let’s say that time has passed since the file was checked in. It’s May 13, and other
people have added several other files to this repository, so the repository is now at r46. If
someone (let’s call her Alice) decides to check out cookies.txt and add the line that calls for
chopped nuts, when she commits her change the repository increments to r47, and this
revision, r47, will contain the new version of cookies.txt in Table 7-2.
TABLE 7-2. cookies.txt r47 committed by Alice on May 13 (with chopped nuts added)
2 1/4 cups flour 1 tsp baking soda 1/2 tsp salt
1 cup butter 3/4 cup sugar 3/4 cup brown sugar
1 tsp vanilla 2 eggs 2 cups chocolate chips
1 cup chopped nuts
Mix butter and sugars. Beat until creamy. Add vanilla. Beat in eggs, one
at a time. Mix in rest of ingredients. Drop by spoonfuls on cookie
sheets. Bake at 350 degrees.
The next time someone checks the tree that contains cookies.txt out of the repository, they
will get r47 of the file. However, they can specifically ask for a previous version in one of
several ways:
• Specifically ask for r23 of cookies.txt.
• Ask for any revision of cookies.txt between, say, 21 and 43. For example, requesting r36
will retrieve the revision associated with r36 of the repository—and since the file has
not changed since r23, this is the revision that will be retrieved.
• Request a copy of cookies.txt as it looked on April 6.
Any of these requests will yield the version of the recipe without the nuts in Table 7-1. Even
if the file is later deleted from the Subversion repository, previous revisions are still available
and can be retrieved by revision number or date. (This means that the file is never perma-
nently deleted from the repository. When a file is “deleted,” the repository simply no longer
lists it in the current revision. If a user checks out an old revision from before the file was
removed, the version of the file associated with that revision is still available.)
DESIGN AND PROGRAMMING 137