I have some experience with Perforce, SVN, and TFS. For SVN, The source files were by default writable after synchronization. However, they were readonly for Perforce, as well as TFS if memory served me.
Meanwhile, 'checkout' means source sync for SVN but its meaning is quite different for other popular tools.
I'm wondering which is more 'correct' behavior and why these tools behave differently.
Thanks.
|
|
|||||||||||
|
|
There used to be two different ways or paradigms with source control. These were:
The first was used by VSS, whereas svn uses the second by default. (TFS has evolved from VSS and I believe Perforce used cvs as a starting point) Using the first paradigm, when getting files from the repository, you haven't said that you want to edit them and the source control marks them as readonly to force you to explicitly 'checkout for edit' the file you want to alter. VSS had commands to 'get latest' and checkout' - and it was checkout that marked the field as editable (and locked it in the repository by default so other couldn't edit the same file at the same time). This leads to issues if one developer checks out and locks a particular file and then goes off on leave, etc. His colleagues cannot edit the file without breaking the lock or hacking into his account. Subversion uses the 2nd, edit/merge/commit paradigm. There is no command to 'get latest' without the ability to edit the file - there is only the checkout command. Several developers can modify a same file a the same time. This leads to other issues at commit. If you and I have both edited the same file, and you commit your changes first, I cannot commit my version without first merging in your changes. There is a risk here that I don't understand the changes you've made and I alter the file so it does what I wanted and breaks the change you had made. Both paradigms have potential issues, but in my opinion the checkout/edit/merge is better. If multiple developers are editing the same files at the same time and have difficultly merging the changes, I believe you've got problems with the code structure and the inter-team communication that cannot be solved by source control tool alone. In order to avoid the issue when one developer has a file locked and cannot be contacted to release the lock, some source control systems allowed locks to be broken or overridden. Some also allow the repository to be set such that some files are not locked and then have to be merged prior to commit - i.e. using an amalgamated checkout/edit/merge/commit. Because of their provenance, their 'get latest' command obtains a read-only copy and insists that you 'checkout for edit' in order to get a writable copy, but they then follow the same flow as subversion with the editing and merging before commit. This is how Perforce works. In order to mitigate the cannot merge changes issue, Subversion does allow the repository to be setup to require locking for some or all files. (I’ve used this is the past to ensure MSWord documentation that was a pain to merge could only be updated by one user at a time, and similarly with picture/icons.) |
|||||||||||||
|