PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1

CHAPTER 17 ■ VERSION CONTROL WITH SUBVERSION


<<<<<<< MINE (select with 'mc') (2,4)
/**




  • @package quizobjects
    */
    ||||||| ORIGINAL (2,0)


    /**



  • @license http://www.example.com Borsetshire Open License

  • @package quizobjects
    */









THEIRS (select with 'tc') (2,5)
class User {}
?>









Subversion includes both Bob’s comment and the conflicting changes, together with metadata that
tells him which part originates where. The conflicting information is separated by a line of equals signs.
Bob’s input is signaled by a line of less-than signs followed by ”MINE”. Data pulled from the repository is
delineated by a line of greater-than signs followed by “THEIRS”.
Now that Bob has identified the conflict, he can choose an action to take in response to it. As you
can see from the previous output, he can accept the repository version. That’s rc for just conflicts,
leaving his non-controversial changes in place, or rf to override his entire version of the document with
that on the server. He can override the repository version. That’s mc to impose his version of only
conflicts or mf to override the entire repository version of the document with his own. He can choose to
postpone action, which will leave the document tagged locally as a conflict until he runs svn resolve on
the file. Most likely, though, he’ll choose the e option, and resolve the conflict by hand. In this case, he
deletes the metadata and arranges the content in the right order:


<?php
/**



/**



  • @package quizobjects
    */
    class User {}
    ?>


Having saved changes and closed the editor window, Bob must still confirm his edit by choosing the
r option, which finally resolves the conflict. Even then, the changes are not committed. Bob must
explicitly commit the changed file for his resolution to make it to the repository. There is an important
principle at work here. Update works from the repository down to the local version. It would not do to
change that flow just because a conflict was detected.


$ svn commit -m 'added class comment' quizobjects/User.php


bob@localhost's password:
Sending quizobjects/User.php
Transmitting file data.

Free download pdf