Application of subversion

Source: Internet
Author: User
Tags svn update
2. Create a file library (create a project)
(For server operations, client operations are not otherwise specified)
Mkdir/usr/local/SVN
Svnadmin create/usr/local/SVN/Java

3. Import project documents (folders) to the database
For example, import a local Java project to the Java directory of the file library:
Mkdir Java
Mkdir Java/trunk // Main Line
Mkdir Java/branches // Branch
Mkdir Java/tags // tag, used to store branches that no longer change
SVN import. http: // localhost/SVN/Java/
-M "Initial repository layout"
Or
SVN import Java http: // localhost/SVN/Java/
-M "Initial repository layout"
4. Checkout (CO) obtains files from the server to the local machine.
All the personnel who want to get the project on the server can use this operation to achieve the goal (of course, they may have permissions)
CD/usr/local/work // first create a local work path
SVN Co http: // localhost/SVN/Java/
-- Username AFA -- password guesswhat
5. webpage access

Http: // server/SVN/Java

Note: you cannot directly access the svn directory.

6. Commit by commit
When you modify or create a file or folder in the local working directory, the repository on the server is not automatically modified. You need to use the commit command to save the local modifications to the server. after each modification, commit adds 1 to the version number on the server.
$ SVN commit-M "Commit message"
7. Add a file or folder

$ Touch test. Java
$ SVN add test. Java
$ SVN commit-M "add test. Java"
8. Update a local Update file
(Update to the latest version without parameters)
$ SVN Update-R 3 test. Java
// Update test. Java to the version submitted for the third time.
Note the following statuses:
A new
D. Delete
U update
C conflict
G merge
Tip: Execute the update operation before each modification, which can greatly reduce the occurrence of conflicts.
9. Create branch and tag)
The difference between branch and Tag: tag is the branch that saves and does not make changes
$ SVN checkout http: // serverip/SVN/Java
$ CD Java
$ SVN copy trunk/calc branches/calc-branch-1.0
$ SVN status
$ SVN commit-M "Creating a private branch of Java"
10. merge branches (1)
1. Merge versions from a specific version
For example, merge the versions on the 343-344 branch to the trunk:
$ Cd to the corresponding directory of the trunk (note the Directory)
(For example,/usr/local/work/Java/trunk)
$ SVN merge-R: 343: 344/
Http: // serverip/SVN/Java/branches/Java-branch-1.0
10. merge branches (2)
2. Merge the entire branch
For example, if a branch is generated from version 341 and needs to be merged now:
$ Cd to the corresponding directory of the trunk (for example,/usr/local/work/Java/trunk)
$ SVN merge-r 341: Head/
Http: // serverip/SVN/Java/branches/Java-branch-1.0
10. merge branches (3)
3. Conflict processing during merging-mainly by manual modification.
<>. Merge-right.r15
Branches 1 add branch Test
Branches 2
Branches 3
After the modification, run the svn resolved command (or manually delete unnecessary control files generated by SVN) and then run the commit command.
11. SVN status
Displays local updates. If no updates (or just commit) are displayed, no information is displayed.

12. "SVN diff" displays detailed update details
$ SVN diff-r 343: 344 http: // serverip/SVN/Java/trunk/work. Java

XIII. SVN revert
Remove a user's local updates (local updates, such as modifications and mergers, are valid when not submitted ).

Fourteen, SVN resolved
After the version conflict is solved manually, run the command before commit to tell SVN that "I have already resolved the conflict. Please submit it." Otherwise, you must manually delete the files generated by SVN, otherwise, you cannot perform the "commit" operation.
$ SVN resolved work. Java // work. Java in the current directory

Fourteen, SVN Delete (1)
1. Local Deletion
$ SVN Delete myfile
$ SVN commit-M "deleted file 'myfile '."

Fourteen, SVN Delete (2)
2. directly on the server (automatic commit)
$ SVN delete/http: // server/SVN/Java/test. Java/
-M "deleting file 'yourfile '"
Note: Both local deletion and direct deletion on the server take effect only for the current version. Deleted items still exist in the previous version to retrieve the deleted items.
Part 3
Subversion.
(Server)

1. Complete backup and recovery
$ Svnadmin dump Java> dumpfile
$ Svnadmin create dumpjava // you can modify the name of a repository (project ).
$ Svnadmin load dumpjava dumpfile1
$ Svnadmin dump myrepos -- Revision 100:2000 -- incremental> dumpfile2
$ Svnadmin dump myrepos -- Revision 200:3000 -- incremental> dumpfile3 _
$ Svnadmin load newrepos <dumpfile1
$ Svnadmin load newrepos <dumpfile2
$ Svnadmin load newrepos <dumpfile3
Part 4
SubversionPermission Control
(Submit to Apache for Management)

1. Create a password file (using Apache's htpasswd)
$ CD/Urs/local/Apache/bin // enter the Apache bin directory.
$ Htpasswd-C/etc/SVN-auth-file AFA
// For The First Time: Use-C to create a password file
$ Htpasswd/etc/SVN-auth-file test
// For the second time, the-C parameter is not used, but the password file (including the path) must be specified)
$
2. Edit the httpd. conf file and add the Authentication Settings (take effect after Apache is restarted)

Dav SVN
Svnparentpath/usr/local/SVN
Authtype basic
Authname"SubversionRepository"
Authuserfile/etc/SVN-auth-File
Require valid-user

3. More precise permission control-group management

Dav SVN
Svnparentpath/usr/local/SVN
Authzsvnaccessfile/etc/SVN/authz. conf
Authtype basic
Authname"SubversionRepository"
Authuserfile/etc/SVN-auth-File
Require valid-user

Iv. Content of authz. conf
[Groups]
Everyone = AFA, test, Tommy, songjy, Robert _
GroupA = AFA, Robert
GroupB = test, Tommy, songjy
[Projecta:/]
@ Everyone = r
_ @ GroupA = RW
[Projectb:/]
_ @ Everyone = r
@ GroupB = RW
Thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.