Linux Learning Chat (ii)
--SVN version control supplements
(Reproduced please attach this article link--linhxx)
First, the concept
The warehouse (repository) is where the code is always stored, and the working copy (working copy) is used by each developer for development. Version control methods such as:
Two developers check out together, one of the developers completed the submission, the other after the submission, must first update the latest warehouse, otherwise cannot be submitted. After checking out, the latter can be submitted. This solution is called "copy-Modify-merge".
However, for binary files such as pictures, it is better to use the locking-modify-unlock model. Therefore, according to the actual situation.
Second, version control method
SVN uses the global version number, and any warehouse working copy commits will change the entire version number. That is, the version number is global, not a version number for each file.
Third, warehouse addressing
It can be addressed by HTTP, file, SVN, and so on, as follows:
Mode |
Access mode |
file:/// |
Direct warehouse access (warehouse on local disk) |
/HTTP |
Access to Subversion-aware Apache servers via the WebDAV protocol |
https:// |
Same AS/HTTP, but added SSL encapsulation (encryption and authorization) |
svn:// |
Access to Svnserve servers through traditional protocols |
svn+ssh:// |
Same as svn://, but added SSH tunnel |
Where you can use ^ to represent the repository's root directory, which can be used in a working copy. In addition, ^/represents the root path.
Iv. Working Copy
The working copy is the directory of the user's local system and is the user's private space. The changes to the SVN repository are not delivered directly from one working copy to another, but rather the user submits the working copy to the warehouse, and the other user updates the code from the warehouse.
Prior to version 1.7, SVN maintained an. SVN directory within each subdirectory of the working copy. svn1.7 presents a completely new approach to storing and maintaining working copy metadata, and the most significant change from the outside is that each working copy creates only one. SVN directory, which is stored in the root directory of the working copy.
1. Working principle
SVN records two information for each file in the working copy: The file's version number and timestamp, which is used to record the last time the file was updated in the repository.
When the user executes SVN ci or svn up, these two items of the file are judged:
1) If the local and the warehouse are not updated, then no response.
2) If the local update, the warehouse is old, then up does not respond, CI will be submitted.
3) If the update is not locally updated, the up will be updated locally, the CI does not respond.
4) If both the local and the warehouse are updated, the direct CI will report the conflict, need up first, but if the same row, SVN up will fail, you will need to manually handle the conflict, and then CI commits.
2. Mixed version number
The current two files A and B in the warehouse, the current version number is 1. Now in the working copy, modify a, and submit. is the 2,b version number or 1 in the working copy, and the A and B version number in the warehouse is 2 (for B, the content of version number 1 and version number 2 is exactly the same). Only the re-working copy, the SVN up is executed again, will make the working copy of a, B version number is also 2.
That is, updates and commits are separate. Commits, does not automatically update code, performs updates, and does not automatically commit code.
--written by Linhxx
More recent articles, please pay attention to the public number "machine learning", or scan the right QR code.
Linux Learning Chat (ii)--SVN version control supplements