13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Implementing Version Control<br />

543<br />

You can solve all these problems with a version control system. Such systems can<br />

track changes to each file in the repository so that you can see not only the current state<br />

of a file, but also the way it looked at any given time in the past.This feature allows you<br />

to roll back broken code to a known working version.You can tag a particular set of file<br />

instances as a release version, meaning that you can continue development on the code<br />

but get access to a copy of the currently released version at any time.<br />

Version control systems also assist multiple programmers in working on code together.<br />

Each programmer can get a copy of the code in the repository (called checking it out)<br />

<strong>and</strong> when he makes changes, these changes can be merged back into the repository<br />

(checked in or committed).Version control systems can therefore track who made each<br />

change to a system.<br />

These systems usually have a facility for managing concurrent updates.This means<br />

that two programmers can actually modify the same file at the same time. For example,<br />

imagine that John <strong>and</strong> Mary have both checked out a copy of the most recent release of<br />

their project. John finishes his changes to a particular file <strong>and</strong> checks it in. Mary also<br />

changes that file <strong>and</strong> tries to check it in as well. If the changes they have made are not in<br />

the same part of the file, the version control system will merge the two versions of the<br />

file. If the changes conflict with each other, Mary will be notified <strong>and</strong> shown the two<br />

different versions. She can then adjust her version of the code to avoid the conflicts.<br />

The version control system used by the majority of Unix <strong>and</strong>/or open source developers<br />

is the Concurrent Versions System (CVS). CVS, which is open source, comes bundled<br />

with virtually every version of Unix, <strong>and</strong> you can also get it for PCs running DOS<br />

or Windows <strong>and</strong> Macs. It supports a client/server model so that you can check code in<br />

or out from any machine with an Internet connection, assuming that the CVS server is<br />

visible on the Internet. It is used for the development of <strong>PHP</strong>, Apache, <strong>and</strong> Mozilla,<br />

among other high-profile projects, at least in part for this reason.<br />

You can download CVS for your system from the CVS home page at http://<br />

ximbiot.com/cvs/wiki/.<br />

Although the base CVS system is a comm<strong>and</strong>-line tool, various add-ons give it a<br />

more attractive front end, including Java-based <strong>and</strong> Windows front ends.You can also<br />

access them from the CVS home page.<br />

Bitkeeper is a rival version control product, used by a few high-profile open source<br />

projects including <strong>MySQL</strong> <strong>and</strong> the Linux kernel. It is available free to open source<br />

projects from http://www.bitkeeper.com/.<br />

Commercial alternatives are also available. One of them is perforce, which runs on<br />

most common platforms <strong>and</strong> has <strong>PHP</strong> support. Although it is commercial, free licenses<br />

are offered for open source projects from the website at http://www.perforce.com/.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!