PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1
CHAPTER 17 ■ VERSION CONTROL WITH SUBVERSION

Committed revision 3.


So far, Bob and I have updated and committed a single file only. By omitting the file argument
altogether, we can apply these commands to every file and directory in the project. Here I run update
from the root directory of the project:


$ svn update


U quizobjects/User.php
Updated to revision 3.


Subversion visits every directory in the project, finding nothing to update until it encounters the
document User.php. Bob’s changes are then incorporated into my version of the document.
You can commit globally in the same way. In this example, I have made minor changes to two
documents, command/Command.php and quiztools/AccessManager.php:


$ svn commit -m'documentation amendments'


Sending command/Command.php
Sending quiztools/AccessManager.php
Transmitting file data ..
Committed revision 4.


Once again, Subversion works through every directory below the current working directory. It takes
no action until it encounters a changed file. At this point, it checks the changes in to the repository.


Adding and Removing Files and Directories


Projects change shape as they develop. Version control software must take account of this, allowing
users to add new files and remove deadwood that would otherwise get in the way.


Adding a File


You can add a new document to Subversion with the add subcommand. Here I add a document called
Question.php to the project:


$ touch quizobjects/Question.php


$ svn add quizobjects/Question.php


A quizobjects/Question.php

Free download pdf