1. svn common commands
1.1 typical working cycle
a. update your working copy
svn udpate
b. modification
svn add
svn delete
svn copy
svn move
c. verify modification
svn status
svn diff
svn revert
d. merge others' modification
svn update
svn resolved
e. submit modification
svn commit
1.2 resolve conflicts (confliction files: filename.mine,
filename.rOLDREV, filename.rNEWREV)
a. abandon the modification: svn revert <filename>
b. remove conflicts temp files: svn resolved
note: once the temp files is deleted with 'svn resolved',
you can submit your file, even though there still are
conflicts in the file.
1.3 check the history
a. svn log
b. svn cat
c. svn list
d. svn diff
1.4 Misc.
a. svn cleanup
b. svn import
c. svn info
2. branch, tag, merge
2.1 svn branch is a copy
create branch: svn copy <src_svn_path> <dest_svn_path> -m "<comments>"
2.2 merge to current local copy
merge branch: svn merge -r <ver1:ver2> <dest_svn_path>
example:
$ svn merge http://svn.example.com/repos/branch1@150 /
http://svn.example.com/repos/branch1@212 /
my-working-copy
$ svn merge -r 100:200 http://svn.example.com/repos/trunk my-working-copy
$ svn merge -r 100:200 http://svn.example.com/repos/trunk
2.3 preview the merge: svn merge --dry-run .....
2.4 svn merge --ignore-ancestry
$ svn diff --notice-ancestry
2.5 find the log from where the branch creates
$ svn log --verbose --stop-on-copy <svn_branch_path>
2.6 copy file from a svn old version, and add it to svn
$ svn copy -r <ver> <svn_path_filename> <path_filename>
2.7 transform an existing working copy to reflect a different branch: svn switch
Note: Not only can working copies contain a mixture of working
revisions, but a mixture of repository locations as well.
2.8 svn tag is copy, there is no diifference between a tag and a branch
create tag: $ svn copy <src_svn_path> <dest_svn_path> -m "<comments>"
3. setup svn server
3.1 startup svn server
$ svnserve -d -r /SVN/xxxxx/
3.2 modify svn user name and passwd
modify file: <storage>/conf/passwd
4. generate and apply patch
4.1 Generate Patch:
#svn diff > xxx.patch
4.2 Apply Patch:
#patch -p0 < xxx.patch
5. Appendix:
$ svn log <filename> -r <key|time|ver>
$ svn diff -r <key|ver> <filename>
Show the latest changes in the repository
#svn log -r 'BASE' -v