Common SVN workflow in Linux

Source: Internet
Author: User
These two articles have set up the svnserve environment on Ubuntu and RedHat5.5. Below we will summarize the specific use process of svn. Server construction 1) Build a code library. # Svnadmin & nbs

These two articles (http://www.linuxidc.com/Linux/2011-08/40592.htm and http://www.linuxidc.com/Linux/2011-08/40593.htm) on Ubuntu and RedHat 5.5 built the svnserve Environment, The following summarizes the specific use of svn process.

Server Construction

1) create a code library.

# Svnadmin create/srv/svn/repos/myproject

2) modify the configuration file svnserve. conf.

Anon_access = none

Auth_access = write

Password_db = passwd where passwd is a file and the default is passwd in the current folder. If you want to use another passwd, You need to specify the path name.

3) configure the passwd file

Add username and password: cobing = 123

4) Start the svnserve Service

# Svnserve-d-T-r/srv/svn/repos

-D indicates that the process svnserve is run in the background as the daemon.

-T indicates that data is processed in multiple threads.

-R can effectively change the root location of the file system. The client can remove the first half of the path, leaving a shorter value.

To enable svnserve to automatically start when the system starts, add it to the/etc/rc. local file.

Client

1) import the local code to the svn code library

# Svn import test svn: // 192.168.146.128/myproject

Note: When the path of the code library was created/srv/svn/repos/myproject, the root directory specified by the svn server is/srv/svn/repos, the current directory of the Code imported by the customer is/myproject. Because svnserve specifies the root directory, accessing 192.168.146.128 is equivalent to accessing the/srv/svn/repos directory on the server. Therefore, you only need to specify the myproject directory. This place is prone to errors. I have been exploring it for a long time to prevent it.

2) After the code is imported into the SVN code base, other users can download and modify the code from the code base. This operation is completed by svn checkout.

# Svn checkout svn: // 192.168.146.128/myproject

After checkout, svn will generate a folder for myproject under your current directory, which is where you will perform various operations and interact with the svn server in the future.

3) Then you can coding, but note: every time you add, delete, move, or copy files under myproject, you must tell svn:

A. add the file and directory # svn add file or directory name

B. delete a file or directory # svn delete file or directory name

C. copy files and directories # svn copy entry name 1 entry name 2

D. Copy the entry and delete the original entry # svn move entry name 1 entry name 2

You only need to modify the existing files of the svn project. svn automatically detects the changes.

4) the file cannot be submitted immediately after modification. There is still a lot to do:

A. Verify the modification.

When you complete the modification, You need to submit them to the version library, but before that, it is a good idea to check what changes have been made. By checking before submission, you can organize a precise log information, or you can find that the file you accidentally modified gives you a chance to restore the modification. In addition, this is a good opportunity to review and carefully check the changes. You can use the command svn status to view the changes and check the details of the changes through svn diff.

# Svn status checks all files and directories you have modified

A item

A file, directory, or symbolic link that is scheduled to be added to the version library.

C item

File item conflicts. When the slave server is updated, it overlaps with the local version. before you submit the file to the version library, you must manually resolve the conflict.

D item

Files, directories, or symbolic items are to be deleted from the version library.

M item

The content of the file item has been modified.

# Svn diff will precisely detect your modifications

B. Cancel local modification.

Assuming that we are looking at the svn diff output, you find that all modifications to a file are incorrect. Maybe you should not modify the file at all, or re-Modify it from the beginning.

# Svn revert file name

C. Manually resolve the conflict and manually change the conflicting file.

D. Use svn update to check the differences between the local version and the server version:

# Svn update

There are three labels:

U: indicates that the local file is not modified.

G: indicates that the local database has been modified, but it does not overlap with the version library. It can be merged.

C: The changes on the server conflict with those on the local server. You must manually resolve the conflict or use svn revert to discard the local changes.

4) At Last, your modification is complete and there is no conflict with the version on the server, so submit it!

# Svn commit-m "LOGMSG"

Do you have any questions? Are you thinking about the differences between svn update and svn status? Isn't it all about checking modifications? After carefully turning over the svn user manual, we will find that the svn revert, svn status, and svn diff commands can be executed even if they are not connected to the svn server. Why? Careful users or users who have used svn on windows will find that there is a svn folder currently working. /svn file. The official document says "Subversion is passed in. the svn management area uses the original version cache for this purpose, which enables reporting and restoring local modifications without having to access the network. This cache is called "text-base ") it also allows the Subversion to generate a compressed incremental ("different") submission based on the original version-even if you have a very fast network, this cache has great benefits, ". You may have understood that, yes, svn status is a comparison between local modification and. svn data, while svn update is a comparison between local modification and server data. The conflicts between the two are different. svn status conflicts between you and the server data in the previous checkout, while svn update conflicts between the current time and server data.

The above operations are all tested on redhat 5.5.

For more advanced operations, see the user manual.

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.