SVN download installation and use tutorial __ Tools

Source: Internet
Author: User
Tags parent directory svn svn update what subversion server port version control system tortoisesvn

SVN profile:

Why you should use SVN.

Programmers in the process of writing, each programmer will generate a lot of different versions, which requires the programmer to effectively manage the code, when needed to quickly and accurately remove the appropriate version.

what subversion is.

It is a free/open source version control system, a set of files stored in the central repository, record every file and directory changes, Subversion allows the data back to the previous version, or check the history of data modification, subversion can access its version of the network library, This allows the user to operate on different computers.

One: SVN server to build and use.

1. First to download and build SVN server, download the following address: http://subversion.apache.org/packages.htmlhttp://subversion.apache.org/ Packages.html, after entering the URL, scroll to the bottom of the browser to see the following screenshot:

Personally think it is best to use the VISUALSVN Server service and TORTOISESVN clients. Click on the above visualsvn connection, download VISUALSVN server, after the download is completed, double-click the installation, the following figure:

Click Next Next, as follows:

Then click Next and Next, as follows:

Click "Next" as follows:

Location refers to the VISUALSVN server's installation directory, Repositorys specifies your version library directory. Server port specifies a port, use secure connection Shan indicates a secured connection,

Click Next to go to the next step, as shown below:

Then click on "Install" to enter the following installation diagram:

When the installation is complete, click "Next" and go to the next step:

Click "Finish" to complete the installation. When the installation is complete, start VisualSVN Server Manager, as shown in the figure:

You can see some information about the library on the right side of the window, such as status, log, user authentication, version library, etc.

To build a version library, you need to right-click the Repositores in the left window, as shown in the following figure:

Select Create New Repository or new->repository in the right-click menu that pops up:

Enter the next step, as shown in the following figure:

Click "Next", as shown below:

Click "Create", the following figure:

Click "Finish" to complete the basic creation.

2. Users and groups need to be established, and permissions need to be assigned .

1. Right-click the user group on the left side of the VisualSVN Server Manager window, select Create User or create a new->user, as shown in the figure:

When you click User, go to the following image:

After completing username and password, click the OK button and enter the following image:

After clicking the "Add" button above, the following figure

Add longen0707 to the user (if there are more than one user, the action is the same).

2. Then we set up the user group, right-click the user group on the left side of the VisualSVN Server Manager window, select Create Group or create a new->group, as shown in the figure:

After clicking on the Group button, enter the following image:

In the pop-up window, fill out group name developers, then click the Add button, select Developer in the pop-up window, join the group, and then click OK.

Next we need to set permissions on the user group, right-click on the Myrepository, and select Properties, as shown in figure:

In the pop-up dialog box, select the Security tab, click the Add button, select longen0707, and then add it, and the permissions are set to Read/write, as shown below:

Click on the "OK" button.

Two: Client SVN installation.

1. First we need to download "svn Little Turtle" after the installation. For example, I download the following:

After the installation is complete, such as in my project in Qiandaun1, I can right-click to see the following:

Description SNV has been installed successfully.

2:checkout the project file.

New or enter the directory (such as Qianduan1), right---> Svn Checkout-->

Where the URL I can get at the SVN server, I'm under myrepositories right click New file

Qianduan file is built, and then like I do right button--> copy under

Can.

Paste the copied version library URL, as shown in the following figure:

Click the "OK" button, you can retrieve it, as follows:

The following figure:

Precautions :

. SVN this hidden directory records two key messages: the base version of the working file and the timestamp of the last updated local copy, and do not manually modify or delete this. SVN hides the directory and the files inside!!, otherwise it will cause your local working copy (static attempt) to be corrupted, No further action is possible.

1) TortoiseSVN icon Introduction

A newly checked-out working copy uses a green check overload to indicate that the subversion status is normal.

After you start editing a file, the state becomes modified, and the icon overload is turned into a red exclamation point. In this way, you can easily see that the files from your last update work copy have been modified and need to be submitted.

If there is a conflict during the commit process, the icon becomes a yellow exclamation point.

The plus sign tells you that a file or directory has been scheduled to be added to version control.

2 TORTOISESVN Client base operation:

1. svn Checkout (svn Checkout)

Right-click in the folder or directory –> Select SVN Checkout, as shown in the following figure

After clicking, enter the directory address of the version library in the Pop-up Library URL box and click OK, as shown below

Then click the OK button, the following figure:

Enter the username and password in the pop-up dialog box, and the project file starts downloading from the remote server to the local working directory after the validation is successful.

Click the OK button to get complete, as shown in the following figure:

2. Add (ADD)

Under the test project file, create a new B.txt file, and submit it to the repository in the following 2 ways:

1. Refer to the list of changes, then commit to the configuration library, select new files, right-click the SVN menu to perform an "ADD" action to submit to the "Change list", and then right-click the SVN menu to perform an "SVN commit" submission to the version library.

2. Do not submit to the list of changes, but directly commit the configuration library, select the file, and right-click the SVN menu to perform an SVN commit operation.

3. Remove (delete)

If the deleted file is not yet in the version library, you can delete the file directly using the operating system's delete operation.

If the deleted file is already in the repository, the deletion is as follows: Select the deleted file, right-click the SVN menu to perform a "delete" operation, then select the parent directory of the deleted file, and right-click the SVN menu to perform an "svn Commit."

Delete the file using the operating system's delete operation, then select the parent directory of the deleted file, right-click the SVN menu to perform an "SVN Commit", and select the deleted file in the change list. The following figure:

4. Renaming (Rename)

Modify the file name, select the file or folder you want to rename, and then right-click "Tortoisesvnàrename", enter a new name in the dialog box that pops up, click the "OK" button, and submit the file or folder after modifying the filename to the SVN server via "SVN commit."

5. SVN restore (svn Revert)

Right-click the file or folder you want to rollback and select "Update to reversion ..." in the TortoiseSVN pop-up menu. A window will then pop up, as follows:

For example, we have to fall back to the 10th version only need to fill in the appropriate version number in the revision, and then click OK.

6. Check for updates (check for modifications)

This feature will show you what changes you have made that have not yet been submitted. This feature will not only see changes to the file, all changes can be seen, including adding files or directories, deleting files or directories, moving files or directories, and so on, if you click on the check version of the library, you can also see the version of the library changes, You have not yet updated the local files which have been submitted by others, as follows:

7. SVN updates (SVN update)

Update the local code in line with the latest version of the SVN server, just right-click on the folder you want to update or right-click in the file's blank, select "SVN Update" (Get the content from the specified version, right-click on the "Update to reversion" in the SVN menu) , it's OK.

7.1 How to resolve conflict files

For each conflicting file subversion placed three files in your directory: as follows:

Why the conflict code is generated. The reason is simple because different people, at the same time to modify the same file in the same place, at this time, he submitted, I did not submit, I will not submit, this moment we have to update first, and then in the submission can be, if there is a conflict, will generate as the top 3 files.

The solution is as follows :

First we can look at the 1.txt code as follows:

<<<<<<< mine

aaaasdf11222333 Dderderder

=======

B>>>>>>>. R5

And then I get rid of the extra code, 1.txt becomes like this

aaaasdf11222333 Dderderder

Commits, or cannot be submitted, as follows:

Why. Because the conflict will produce the above three files, there are certainly 3 files on the above will not be submitted, the three file code and explained as follows: 1.txt.mine is a file before the conflict. Can look at the following content:

aaaasdf11222333 Dderderder

2.1.TXT.R4 is a pre-conflict local version of the file

The contents are as follows: aaaasdf11222333

3.1.TXT.R5 is the version that someone else has submitted before you.

The contents are as follows: b

Among them, <<<<<<<<.mine ... ======= code is your own, while ======......>>>>>>>. R5 is part of the code that someone else is in conflict with you.

It is not difficult to understand why there is such a strange thing about conflict, because the same piece of code that you have modified, of course, will conflict.

The solution is as follows: If my current 1.txt conflict is as follows:

<<<<<<< mine

6666666666666600000

=======

66666666666aaaaaaaaaa666

>>>>>>> R16
before I said <<<<<<< mine ... =======

...... The code between is the code that I modified before I had a conflict,

======= .........>>>>>>>. R16 The middle of this ... The code is someone else and I conflict code part, from the above code can see AAAAAAAAA is my colleague added, 00000 is I added later. Using the revert (rollback) operation, which means that the user abandons his or her update code and submits it directly, this time your code will cause the latest code on the server to be submitted by a user, and your code will not be submitted as follows:

Click the OK button to see the other three files are automatically deleted, 1.txt code into the following code:

66666666666aaaaaaaaaa666

That is, a user submitted code, my own updated code need to manually copy in to submit a commit. If I am now 3.txt generate conflict code as follows:

<<<<<<< mine

333333338888888888888=======

3333cccccccccc3333>>>>>>>. R16

Through the 1th we know, 333333338888888888888 this content is I modified, did not produce conflict before the content, 3333cccccccccc3333 this code is a user submitted code, from the above learned a user new content is CCCCCCC, And my new content is 8888888.

So the second solution is as follows:

Select File-> Right Editconficts: This method requires both sides of the conflict to be negotiated after the code changes are consolidated and then submitted. Not only does it resolve the conflict but it also guarantees that the code is correct because only one side of the code is committed.

As shown in the figure above, the red part is the conflict code: theirs represents the most recent code on the current server side, mine represents its own modified code, and merged represents the merged code. Click on the Red Right button to select: Use the text block can be this part of the code as merged code

Let's talk about the situation where important code is overwritten because of the conflict. If the action taken at the time of the conflict is not possible, some code will be lost, and it will be easy to restore the code before it is restored.

Select File-> Right click on show log in here you can see all the previous versions submitted, find the version you want to restore right click Revert to this version can be restored.

SVN commit (svn commit)

SVN's submission is to submit changes made in the workspace, including changes to the contents of the file, additions to the file or directory, deletion, naming, moving, and so on. As shown in the following illustration:

8. Display log (show log)

With this feature, you can find out who, when, what those files in that directory are doing, the following figure:

9. Version Gallery browse (Repo-browser)

This feature is used to browse the database that needs to be viewed, right-click in the local folder, select Tortoisesvnàrepo-browser, enter the database address in the pop-up dialog box, and then enter the username and password to see what you need to see in the version library. You can also see who locked those files, as shown here:

Three: Create branch merges interoperate

Why do you want to create a branch and merge in your project?

For example I now project all the files on the trunk (trunk), because of changes in requirements, need to add new requirements, but we have to continue to develop the backbone, where we can create a new branch, to add new requirements that piece, continue to develop the backbone, and so on the branch code no problem, And then merge it into the trunk.

The biggest goal of creating a branch is to parallel development with the mainline without affecting the development of the mainline.

how to operate.

If I create a new folder locally, test has 2 folders trunk (storing the code on the Backbone) and branch (the Code on the branch), as follows:

One: First extract the code on the backbone.

Click Trunk--> the right mouse button--> Click SVN Checkout--> Pop-up a dialog box, as shown in the following image:

The URL above is obtained from the server VISUALSVN, as follows:

Direct right key qianduan3--> Copy URL to Clipboard can.

The QIANDUAN3 project has the following files, as shown in the following illustration:

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.