CentOS5.5 and ubuntu14.14 install svn and configure centos5.5svn

Source: Internet
Author: User
Tags svn update

CentOS5.5 and ubuntu14.14 install svn and configure centos5.5svn

1. Environment
Centos5.5

2. Install svn

yum -y install subversion

3. Configuration

Create a version library directory

mkdir /www/svndatasvnserve -d -r /www/svndata

4. Create a version Library

Create a new Subversion Project

svnadmin create /www/svndata/oplinux

Configure to allow rsync access

cd /www/svndata/oplinux/confvi svnserve.confanon-access=noneauth-access=writepassword-db=passwd 

Note: there must be no space before the modified file; otherwise, an error occurred while starting the svn server.

Vi passwd [users] # <user 1 >=< password 1 >#< user 2 >=< password 2> david = 123456

5. Client Connection

Svn co svn: // ip/oplinux username and password: 123456

========================================================== ======================================

6. To synchronize SVN and WEB, you can CO it or directly configure it in the repository.

1) set the root directory of the WEB server to/www/webroot.

2) checkout SVN

svn co svn://localhost/oplinux /www/webroot

  

Modify permissions to WEB users

chown -R apache:apache /www/webroot/oplinux

 

3) create a synchronization script

cd /www/svndata/oplinux/hooks/cp post-commit.tmpl post-commit

  

Edit post-commit and add the following content at the end of the file:

export LANG=en_US.UTF-8SVN=/usr/bin/svnWEB=/www/webroot/$SVN update $WEB –username rsync –password rsyncchown -R apache:apache $WEB

 

Add script execution permission

chmod +x post-commit

Else ---------------------------------------------------------------------------------------------------------------------------------

Install svn under ubuntu14.14

sudo apt-get install subversion subversion-tools

  

1. Check out
Svn co http: // path (full directory or file path) [full local directory path] -- username -- password svn co svn: // path (full directory or file path) [full local directory path] -- username -- password
Svn checkout http: // path (full directory or file path) [full local directory path] -- username
Svn checkout svn: // path (full directory or file path) [full local directory path] -- username
Note: If the -- password parameter is not included, the system will prompt you to enter the password. We recommend that you do not use the -- password option in plain text.
Username and password are two short-term, not one.
If the full path of the local directory is not specified, the local directory is checked out.
Example:

Svn co svn: // 192.168.0.3/test tool/home/testtools -- username wzhnscsvn co http: // 192.168.0.3/test/testapp -- username wzhnscsvn checkout svn: // 192.168.0.3/test tool/home/testtools -- username wzhnscsvn checkouthttp: // 192.168.0.3/test/testapp -- username wzhnsc

  

2. Export (export a directory tree without the. svn folder)
Svn export [-r version] http: // path (full path of directory or file) [full path of local directory] -- username
Svn export [-r version] svn: // path (full path of directory or file) [full path of local directory] -- username
Local directory full path (with. svn folder) detected by svn export to Be Exported
Note: The first method to export the working directory tree from the version library is to specify the URL,
If the version number is specified, the corresponding version is exported,
If no version is specified, the latest version is exported to the specified location.
If the full path of the local directory is omitted, the last part of the URL is used as the name of the local directory.
The second method is to specify the full path of the local directory to be exported. All local modifications will be retained,
But files that are not under Version Control (that is, new files that are not submitted, because there is no related information record in the. svn folder) will not be copied.
Example:

Svn exportsvn: // 192.168.0.3/test tool/home/testtools -- username wzhnscsvn exporthttp: // 192.168.0.3/test/testapp -- username wzhnscsvn export/home/testapp/home/testtools

  

3. Add a new file
Svn add file name
Note: Tell the SVN server to add files and use svn commint-m to upload files!
Example:

Svn add test. php <-add test. php svn commit-m "add my test with test. php "test. phpsvn add *. php <-add all the php files under the current directory svn commit-m "add my test with all php files" *. php

  

4. Submit
Svn commit-m "submit remarks text" [-N] [-- no-unlock] File Name
Svn ci-m "submit remarks text" [-N] [-- no-unlock] File Name
The-m parameter must be included. The parameter can be null, but it must be written as-m.
Example:

Svn commit-m "submit all files in the current directory under Version Control" * <-note this * indicates all files svn commit-m "submit my test. php "test. phpsvn commit-m "submit my test with test. php "-N -- no-unlock test. php <-keep the lock and use-no-unlock to switch svn ci-m "submit all files in the current directory under Version Control" * <-note this * indicates all files svn ci-m "submit my test. php "test. phpsvn ci-m "submit my test with test. php "-N -- no-unlock test. php <-use the-no-unlock switch to keep the lock

  

5. Update files
Svn update
Svn update-r Revised Version file name
Svn update file name
Example:
Svn update <-No directory later. By default, all files in the current directory and sub-directories are updated to the latest version.
Svn update-r 200 test. cpp <-restore the file test. cpp in the version Library to the revised version (revision) 200
Svn update test. php <-Synchronize updates with version libraries.
An expiration conflict is prompted during submission. You need to update and modify the file first,
Then clear the svn resolved and submit the commit.

6. delete an object
Svn delete svn: // path (full directory or file path)-m "delete remarks text"
The following operations are recommended:
Svn delete file name
Svn ci-m "delete remarks text"
Example:
Svn delete svn: // 192.168.1.1/testapp/test. php-m "delete test file test. php"
The following operations are recommended:
Svn delete test. php
Svn ci-m "delete test. php"

7. Lock/unlock
Svn lock-m "lock remarks text" [-- force] File Name
Svn unlock file name
Example:
Svn lock-m "test the test. php file" test. php"
Svn unlock test. php

8. Differences
Svn diff file name
Svn diff-r corrected version number m: Corrected version number n file name
Example:
Svn diff test. php <-compare the modified file with the basic version
Svn diff-r 200:201 test. php <-differences between version 200 and version 201

9. view the file or directory status
Svn st directory path/Name
Svn status directory path/name <-the status of the files and subdirectories under the directory. The normal status is not displayed.
【? : Not under svn control; M: The content is modified; C: A conflict occurs;
A: To be added to the version Library; K: locked]
Svn-v directory path/Name
Svn status-v directory path/name <-display file and subdirectory status
[The first column remains the same, and the second column displays the working version number,
The version number and modifier of the last modification are displayed in columns 3 and 4]
Note: svn status, svn diff, and svn revert commands can be executed without a network,
The reason is that svn retains the original copy of the local version in local. svn.

10. View logs
Svn log File Name
Example:
Svn log test. php <-displays all changes to the file and changes to the version number.

11. View File details
Svn info file name
Example:
Svn info test. php

12. SVN help
Svn help <-all functional options
Svn help ci <-Function Description

13. view the files and directories in the version Library
Svn list svn: // path (full directory or file path)
Svn ls svn: // path (full directory or file path)
Example:

Svn list svn: // 192.168.0.3/testsvn ls svn: // 192.168.0.3/test <-display all files and directories belonging to the version library under the svn: // 192.168.0.3/test directory

  

14. Create a new directory under Version Control
Svn mkdir directory name
Svn mkdir-m "add directory remarks text" http: // full directory path
Example:

svn mkdir newdirsvn mkdir -m "Making a new dir." http://192.168.0.3/test/newdir 

  


Note: After adding a subdirectory, you must update it in the root directory. Otherwise, a message indicating "failed to submit" is displayed when you submit the file in this directory"
Svn update
Note: If you manually create a new folder newsubdir in the directory that comes out of checkout,
After the svn mkdir newsubdir command is used, SVN will prompt:
Svn: how to replace "svn add" or "svn add -- non-recursive?
Svn: Unable to create directory "hello": the file already exists
Run the following command to solve the problem:
Svn add -- non-recursive newsubdir
In the newsubdir folder, use ls-a to view all the directories and files under it, and you will find more:. svn directory
Run the svn mkdir-m "add hello function module File" svn: // 192.168.0.3/test/newdir/newsubdir command,
SVN prompt:
Svn: File already exists: filesystem '/data/svnroot/test/db', transaction '2017-1 ',
Path '/newdir/newsubdir'

15. Restore local modification
Svn revert [-- recursive] File Name
Note: The sub-commands do not access the network and will release the conflict. However, it does not restore the deleted directory.
Example:
Svn revert foo. c <-Discard modifications to a file
Svn revert -- recursive. <-restore the entire directory file.

16. Copy the job and update it to another URL.
Svn switch http: // directory full path local directory full path
Example:
Svn switch http: // 192.163.0.3/test/456. <-(original 123 Branch) branch of the current directory to 192.163.0.3/test/456

17. Conflict Resolution
Svn resolved [full local directory]
Example:
$ Svn update
C foo. c
Updated to revision 31.
If you get a conflict during the update, your work copy will generate three new files:
$ Ls
Foo. c
Foo. c. mine
Foo. c. r30
Foo. c. r31
When you solve the foo. c conflict and are ready to submit, run svn resolved to let your work copy know that you have done everything.
You can only delete and submit conflicting files. However, in addition to deleting conflicting files, svn resolved also fixes record data in the work copy management area. Therefore, we recommend that you use this command.

18. view the output content of a specific file or URL without checkout
Svn cat http: // full file path
Example:
Svn cat http: // 192.168.0.3/test/readme.txt

Related Article

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.