SVN server-side installation
Yum-y Install Subversion
# mkdir/data/svndata #
cd/data/svndata
# svnadmin Create itopic
use Branc Hes/tags/trunk directory Structure
# mkdir-p Code/{branches,tags,trunk}
# SVN import Code file:///data/svndata/itopic-m ' init "
SVN configuration
Itopic/conf has 3 files (svnserve.conf, passwd, Authz) to configure SVN-related access information.
Svnserve.conf
Reference configuration:
# more svnserve.conf
[general]
anon-access = none
auth-access = Write
password-db = passwd
authz-db = Authz
realm = itopic Repository
[SASL]
# USE-SASL = True
# min-encryption = 0
# max- Encryption = 256
passwd
Reference configuration:
# more passwd
[users]
Bobby = 123456
judy = abc123
kim = abc!@#
Authz
Reference configuration: Set as development group and test group, developers have trunk, branches read and write permissions; The test group only has branched Read permission, but the test group's Kim also has the read and write permission of tags.
# more Authz
[groups]
developer = Bobby
tester = Judy,kim
[itopic:/]
* = r
[ Itopic:/trunk]
@developer = RW
* =
[Itopic:/branches]
@developer = RW
@tester = R
* =
[Itopic:/tags]
Kim = RW
* =
SVN startup
# svnserve-d-r/data/svndata
How a single project starts
# svnserve-d-r/data/svndata/itopic
# svnserve-d--listen-port 3691-r/data/svndata/laozi
power-on Boot
# echo ' svnserve-d-r/data/svndata ' >>/etc/rc.local
SVN command
1, checkout the file to the local directory
SVN checkout Path (path is a directory on the server)
For example: SVN checkout Svn://192.168.1.1/pro/domain
Shorthand: SVN Co
2, add new files to the version library
SVN Add File
For example: SVN add test.php (add test.php)
SVN add *.php (Add all php files under current directory)
3, the change of the file submitted to the version of the library
SVN commit-m "LogMessage" [-n] [--no-unlock] PATH (if you choose to keep the lock, use the? No-unlock switch)
For example: SVN commit-m "Add test file for my test" test.php
Shorthand: svn ci
4, lock/unlock
SVN lock-m "Lockmessage" [--force] PATH
For example: SVN lock-m "lock test File" test.php
SVN unlock PATH
5. Update to a version
SVN update-r m path
For example:
SVN update If there is no directory behind it, the current directory and all files under the subdirectory are updated to the latest version by default.
SVN update-r test.php (restores the file test.php in the version library to version 200)
SVN update test.php (update, sync with version library). If the prompt expires at the time of submission, it is because of the conflict, you need to update, modify the file, then clear the SVN resolved, and then commit the commit.
Shorthand: SVN up
6. View file or directory status
1 SVN status Path (the state of the files and subdirectories under the directory, not shown in the normal state)
"?: not in the control of SVN; M: Content modified; C: conflict; A: scheduled to join repository; K: Locked
2 svn status-v path (displaying file and subdirectory status)
The first column remains the same, the second column displays the working version number, and the third and fourth columns display the last modified version number and the modified person.
Note: SVN status, SVN diff, and SVN revert these three commands can also be performed without a network, because SVN is local. SVN retains the original copy of the local version.
Shorthand: SVN St
7, delete the file
SVN delete path-m "Delete test Fle"
For example: SVN delete svn://192.168.1.1/pro/domain/test.php-m "Delete test file"
Or simply svn delete test.php and then svn ci-m ' delete test file ', recommend using this
Shorthand: SVN (del, remove, RM)
8, view the log
SVN log path
For example: SVN log test.php shows all the changes to this file, and its version number
9. View File Details
SVN info Path
For example: SVN info test.php
10, compare the difference
SVN diff path (compares the modified file to the base version)
For example: SVN diff test.php
SVN diff-r m:n Path (diff for version M and version N)
For example: SVN diff-r 200:201 test.php
Shorthand: SVN di
11. Merge the differences between the two versions into the current file
SVN merge-r m:n Path
For example, SVN merge-r 200:205 test.php (merges the differences between version 200 and 205 into the current file, but generally conflicts and needs to be addressed)
12, SVN Help
SVN help
SVN help CI
The above is the common command, below write a few commonly used
13, File and directory list under the version library
SVN list Path
Show all files and directories that belong to the version library under the path directory
Shorthand: SVN ls
14. Create a new directory under version control
SVN mkdir: Create a new directory under version control.
Usage: 1, mkdir PATH ...
2, mkdir URL ...
Create a directory for version control.
1. Each directory specified in the working copy PATH will be created on the local side and added
Schedule to be submitted for the next time.
2. Each directory specified as a URL will be created by submitting it immediately to the warehouse.
In both cases, all intermediate directories must exist beforehand.
15. Restore Local Modifications
SVN revert: Restores the original unchanged working copy file (restores most of the local modifications). Revert
Usage: revert PATH ...
Note: The notebook command does not access the network and will remove the conflicting status. But it won't recover.
The deleted directory
16. Code base URL Change
SVN switch (SW): Updates the working copy to a different URL.
Usage: 1, switch URL [PATH]
2. Switch relocate from to [PATH ...]
1, update your working copy, map to a new URL, its behavior and "SVN update" is similar, will also
The file on the server is merged with the local file. This corresponds to a branch or tag in the same warehouse where the working copy is
Method.
2, rewrite the working copy of the URL metadata to reflect the simple URL changes. When the root URL of the warehouse changes
(for example, schema name or host name change), but the working copy is still mapped to the same directory in the same warehouse.
This command updates the working copy's correspondence with the warehouse.
17. Conflict resolution
SVN resolved: Removes the conflicting state of a working copy's directory or file.
Usage: Resolved PATH ...
Note: The notebook command does not resolve the conflict according to syntax or remove the conflict token; it simply removes the conflicting
Related files, and then allow PATH to be submitted again.
18, output the contents of the specified file or URL.
SVN cat Target [@ VERSION] ... If a version is specified, the lookup is started from the specified version.
SVN cat-r PREV filename > filename (PREV is the previous version, can also write specific version number, so that the output can be submitted)