Shenzhen letter lion SVN technical documentation

First, what is the SVN
concept:
svn (Subversion) is a cross-platform version management system, similar to a file server, but you can record each file modification update every record, so that you can roll back to any old time version, can be used to manage the program source code, other file types (text, video, pictures, etc.);
1) there is a simple but not very accurate metaphor: SVN = + version control backup server
2) you can think of SVN as your backup server, better yet, he can help you remember each upload files to this server. And automatically gives each time a version change.
Here Insert Picture Description

Second, install SVN service
yum install -y subversion
create a repository
mkdir -p / data / svnroot / myproject ( custom directories)
svnadmin the Create / the Data / svnroot / myproject // initialization files
cd! $ / Conf #authz permissions configuration file, passwd as the password file
[[Email protected] conf] # LS
authz passwd svnserve.conf

Third, the configuration
vim authz // configuration file to read as follows
[Groups]
Admins ADMIN =
User = test1, test2
[/]
@admins RW =

  • R & lt =
    [MyProject: /]
    @admin RW =
    @user = RW
    configuration in detail:
    [Groups] // Group name
    Admins ADMIN =
    @user = test1, test2 // definition of the group name is Admins
    [/] // file directory / Data / svnroot / MyProject
    @admins Admins = RW // read-write access to this group
  • = R // other users are read-only
    [myproject: /] // / myproject other items in the data / svnroot / project directory just a
    @user = rw // user1 myproject the user-defined program is read and write permissions

Edit Profile Password:
Vim added following the passwd //
[Users]
ADMIN = 123 ABC-
test1 = 123 ABC-
test2 = ABC-123

Edit the configuration file:
vim svnserver.conf // change or add the following
[General]
anon-Access = none // anonymous user does not have any authority
auth-access = write // authorized user write permission on
password-db = passwd // user password storage file
authz-db = authz // access control of stored files
realm = / data / svnroot / myproject // project for which the entry into force

Fourth, start Server svn:
svnserve -d -r / the Data / svnroot
netstat -nultp | grep svnserv

Fifth, use svn (linux) on the client
yum -y install Subversion
mkdir / Home / svntest
cd $!
Svn Checkout svn: // //192.168.96.129/myproject --username = test1 Once you have successfully connected to the local client will be saved one has been connected to the server account and password
cd myproject
LS -la
cp / etc / fstab.
svn the Add. // add to version control center
svn commit -m "add fstab" // upload files to the server
is increasing fstab
transfer file data.
version of the submission is 1.

svn up // push ,,, the server to see you will find there is a fstab file
svn delete fstab // delete the local
svn commit -m "delete fstab" // deleted on the server
svn update // the current directory the files are updated to the latest version of
svn log // View change log

Sixth, use svn (windows) on the client
after download and install (Some computers may need to restart) and then create a folder within a disk, right-click will be "SVN CHECKOUT" to enter a user name and password, it will be just edited fstab file!
And Linux clients almost, when we create a new file is complete, right-click click on the "add" and then we click again on "add commit"
Here Insert Picture description
That's it!

Again to refresh the server can
svn up

Then we just create a file in the linux server, as long as the end of the right-click "myproject" in the windows client can update!

Seven extended commands
1, the checkout files to a local directory
svn checkout path (path is the directory on the server)
For example: svn checkout svn: //192.168.1.1/pro/domain
shorthand: svn CO
2, to add a new repository files
svn add file
For example: svn add test.php (added test.php)
svn * .php the Add (add the current directory of all the php file)
submitted 3, the changed files to the repository
svn commit -m "LogMessage" [-N] [-no-unlock] the PATH
(if selected to maintain lock on the use -no-unlock switch)
example: svn commit -m "add test file for my test" test.php
shorthand: the svn CI
. 4, plus lock / unlock
svn lock -m "LockMessage" [-force ] pATH
For example: svn -m lock "lock the Test File" test.php
svn uNLOCK the pATH
5, update to a version
svn update -rm path
example:
svn update if the latter no directory, by default the current directory and all files in subdirectories are updated to the latest version.
svn update -r 200 test.php (the version of the library file test.php revert to version 200)
svn Update test.php (updated, synchronized with the repository. If you are prompted expired at the time of filing of the case, because the conflict, need first update, modify the file, and then clear the svn resolved, and finally submitted to commit)
shorthand: svn up
6, view the file or directory state
1) svn status path
state files and subdirectories under (catalog, the normal state is not displayed)
【?: svn not in control; M: the content is modified; C: conflict; a: is added to the predetermined repository; K: is locked]
2) -v path svn status
(status display files and subdirectories)
the first column remains the same, the second column shows the working version, the third and fourth columns show the last modified version and modify people.
Note: svn status, svn diff, and svn revert command in the absence of these three cases the network can also be performed, because svn retain the local version of the original copy in the local .svn.
Shorthand: svn ST
7, delete files
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 directly svn delete test. php then svn ci -m 'delete test file' , we recommended to use this
shorthand: svn (del, remove, rm )
8, view the log
svn log path
For example: svn log test.php shows the change records all modifications of the file, and the version number
9, view file details
svn info path
For example: svn info test.php
10, the difference
svn diff path (the modified file Compare with base)
example: svn the diff test.php
the svn the diff -rm: n path (version n to version differences and m)
, for example: svn diff -r 200: 201 test.php
shorthand: svn DI
. 11, the difference between the two versions in the current file
svn merge -rm: n path
example: svn merge -r 200: 205 test.php ( the difference between 200 and the version 205 into the current file, but usually in conflict, need to deal with it)
12, sVN help
svn help
svn help CI

These are commonly used commands, the following write a few not often used

13, files and directories in the repository list
svn list path
Show all belong to the repository of files and directories path directory
shorthand: svn LS
14, create a new directory under version control
svn mkdir: created into the new under version control table of Contents.
Usage: 1, the PATH ... mkdir
2, the URL of ... mkdir
to create a directory under version control.
1, each designated by a working copy of the PATH directory, is created locally end, and scheduled for addition, to be submitted once the next.
2, each directory specified by a URL, is created in the repository via an immediate commit. In both cases, all the intermediate directories must already exist.
15, to restore the local modifications
svn revert: Restore pristine working copy file (undo most local edits).
revert:
Usage: revert PATH ...
Note: this subcommand does not require network access, and resolves conflict situation. But it does not restore removed directories
16, the code base URL change
svn switch (sw): Update the working copy to a different URL.
Usage: 1, Switch the URL of [the PATH]
2, the FROM Switch --relocate the TO [the PATH ...]
1, update your working copy to mirror a new URL, its behavior with the "svn update" like, will also server on the file merged with a local file. This is a working copy of the correspondence to the same warehouse in a branch or tag method.
2, URL rewriting working copy metadata to reflect changes in simple URL. Use this command to update the working copy of the correspondence between the warehouse and the warehouse when the root URL changes (such as program name or hostname change) but your working copy still reflects the same repository in the same directory.
17, to resolve the conflict
svn resolved: "conflict" state to remove the working copy of the directory or file.
Usage: resolved PATH ...
Note: this subcommand does not semantically resolve conflicts or to remove conflict markers; it merely removes conflict-related documents, and then let the PATH to be committed again.
18, the contents of the specified output file or URL.
svn cat TARGET [@ REV] ... If the specified version, the version from the specified start looking.
svn cat -r PREV filename> filename ( PREV is the previous version, you can also write the specific version number, so that the output can be submitted)

Published 29 original articles · won praise 0 · Views 590

Guess you like

Origin blog.csdn.net/drrui520/article/details/105129130