VisualSVN server server and TortoiseSVN client newbie guide

  • Introduction to SVN:

     Why use SVN?

          In the process of writing a program, each programmer will generate many different versions, which requires the programmer to effectively manage the code, and can quickly and accurately extract the corresponding version when needed.

    What is Subversion?

       It is a free/open source version control system. A set of files is stored in a central repository, and every file and directory modification is recorded. Subversion allows data to be restored to an earlier version, or to check the history of data modification. Subversion can pass the network Access its repository, allowing users to work on different computers.

    One: SVN server construction and use.

       1. First, download and build the SVN server . The download address is as follows http://subversion.apache.org/packages.html . After entering the URL, scroll to the bottom of the browser to see the following screenshot:

      

          Personally, I think it is best to use the VisualSVN server server and  TortoiseSVN client together .  Click on the VisualSVN connection above , download the VisualSVN server, and double-click to install after the download is complete, as shown below:

     

    Click Next to next step, as follows:

    Then click the Next item, the next step is as follows:

     

    Click【Next】as follows:

     

    Location refers to the installation directory of VisualSVN Server , Repositorys is to specify your repository directory. Server Port specifies a port , Use secure connection Goushan means to use a secure connection ,

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

    Then click [ Install] to enter the following installation diagram:

    After the installation is complete, click [ next] to enter the next step: as shown below

    Click [ Finish] to complete the installation. After the installation is complete , start VisualSVN Server Manager, as shown in the figure :

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

    To create a repository , you need to right-click on Repositores in the left window, as shown below :

    In the pop-up context menu, select Create New Repository or New- >Repository:

    Go to the next step, as shown below:

    Click [Next], as shown below:

    Click [ create], as shown below:

    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 and select Create User or New->User, as shown in the figure:

      

    After clicking User, enter the following figure:

    After filling in the Username and password, click the ok button to enter the following figure:

    After clicking the [ Add] button above, the picture is as follows

    Add longen0707 to the user (if there are multiple users, the operation is the same ).

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

      

    After clicking the [ Group] button, enter the following figure:

    Fill in the Group name as Developers in the pop-up window, 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 for the user group, right-click on MyRepository and select Properties , as shown in the figure :

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

    Click the [OK] button.

    --------------------Installation and use of the client -----------------

Installation Notes

Developers strongly recommend using the SVN plugin in the IDE to be more intelligent and user-friendly.

First install the SVN client. Windows generally choose the turtle client https://tortoisesvn.net/downloads.html .
Select the corresponding client to install according to the number of system bits.

image_1ak3avt6j1k2p1f6h1cg711lp3pu9.png-57.9kB

If you like to use the command line, please remember to check command line client toolas will be install on local hard driver, skip this step without the command line.

image_1ak3cf587b5a15j21i9s1ne8uhf1g.png-55kB

Then all the way to next can be installed. After installation, right-click anywhere to view the shortcut menu. If found TortoiseSVN, the installation is successful.

image_1ak3cneu9tb6pu8k44rck90k1t.png-135kB

If the installation command line tool is checked, then enter the command SVN, and the following prompt also indicates that the installation is successful

image_1ak3ctqp61c0a1vku1e30cib9312a.png-9.6kB

But the menus are all in English at this time. If you are not used to English, you can download the language pack and remember to check the system digits.

image_1ak3b28uv1et21lelqiglpr1krjm.png-46.3kB

After installing the language pack, you can right-click to enter the settingsettings.

image_1ak3d7reg1tdhdqjhfhim319d2n.png-89.7kB

Select the language you like (such as Chinese), and then confirm, no accident, the language has now been switched to Chinese.

image_1ak3dama4kcf1flmr9a8d1hqe34.png-187kB

This is the end of the installation tutorial. Let's start to introduce the use of SVN.

Instructions for use

Check out an item

If the project is already in the server's repository, all you have to do now is to check it out locally.
First create an empty folder. Right-click in an empty folder and select SVN Checkout.

image_1ak3do46q18kl1l79c9u4pu1mdd3h.png-21.5kB

Now you see this interface, fill in the repository address, and select OK.

image_1ak3dsjn6ha81ojlg2a1b1h67o3u.png-40.8kB

A dialog box will pop up for you to enter your account password, just enter your account password. Remember to tick Save Authentication, otherwise you will be asked to enter every time you operate.

image_1ak3e0eesor01kg616s81aj11h524b.png-21.5kB

Check out in a few minutes.

image_1ak3e38931rr19dg1cbd1t8pn3g4o.png-51.4kB

At this point you can see your project in your directory, and now you can start working happily.

image_1ak3e6ja4gnsvep1oaluia2pp55.png-5.3kB

import project

But sometimes you have already built a project locally and need to push your project to SVN. What should you do at this time?
Right-click and select Repository Browser.

image_1ak3eopb116i6192u14i4c7r1avu6c.png-101kB

In the corresponding directory, right-click, add file/add folder, and select the corresponding directory.

image_1ak3etni4fba1oi017rv1u6m1gn16p.png-116kB

For example, I now have a project called SVNProject, and I want to upload it to SVN.

image_1ak3f04bl1k5q1qmrrcmu4m1j2j76.png-50.7kB

Then I just choose to join the folder.

image_1ak3f5l6f1h8f1rimgee1544sdc7j.png-35kB

Be sure to enter submission information. So others can know what you did.

image_1ak3f7oe71gs6mkdlucdrrqq880.png-31.7kB

After the import is successful, you can see the directory.

image_1ak3fbqo13gu1uji53ku5g1bs68d.png-110.6kB

However, don't assume that the import is successful and that's it. You have to check out again, the re-checked out project is controlled by SVN, be sure to remember to check out.

image_1ak3fghhcg9fk9oab61n5q1sqg8q.png-110.6kB

Right-click on SVNProject to check out to the local, and then modify it inside. Now you can work happily.
The right-click menu after checking out becomes like this.

image_1ak3fnbnn1ber1u0k1hbs1ti6ovi97.png-24.4kB

submit

Green indicates that the current file has not been modified (restart the computer if you cannot see the color).

image_1ak3g3u171j9j1r40mbp1hkv12ju9.png-4.1kB

Suppose I now 我是新项目.txtadd a line of words in and save it.

image_1ak3g7ct21svq1lrejruu6e16okm.png-6.1kB

The discovery is now red, which means it has been modified.

image_1ak3g9vfl1rqc1mvb19s81hg1t3913.png-4.9kB

How to submit changes?
In the root directory, right-click and select Submit.

image_1ak3gdc7j17dt1n50d1l8e1trp1g.png-25.2kB

Be sure to remember to enter the submission information (although you can submit it without entering it), the submission information can be easily viewed in the future.

image_1ak3gif5h13l11rfmorm87g5a71t.png-74kB

After the submission is complete, it can be found that it has returned to green.

image_1ak3gngr3o2amk41abkod91ogi2a.png-5kB

Suppose now that a new file is added. It can be seen to be blue. Blue indicates unknown files that do not belong to the repository, and unknown files cannot be submitted.

image_1ak3grpb5hgbs62sj4tthfql2n.png-11.6kB

Remember to select Add to add it to the repository.

image_1ak3h1boe1njh1dhrhu1bjr1t333k.png-50.7kB

After the addition is complete, it becomes a blue plus sign, indicating the newly added version library file.

image_1ak3h5j9j1j4cnfhhq2vv2lba41.png-4.3kB

Next, just write the code and submit it.
Deleted files should also be right-clicked and submitted, as follows.

image_1ak3hcqrakda18mc5pg1dlke4d4e.png-57.7kB

Remember to check the status of your files at any time, and if they are not added to version control, add them in time, otherwise your files will not be submitted.

renew

Suppose you and classmate B are collaborating. After classmate B wrote the code and submitted it to SVN, if you want to get the latest modification, you need to select update (if there are new ones submitted by others on the server, you cannot submit them, you must update them before submitting).
How do I know if the server has been updated? You can directly choose to update, and you will know if there is an update. Or right-click to check for changes, and then check the repository to see which files have been changed on the server.

image_1ak3i1mon1f871qr9178eds61qoq4r.png-100.3kB

Right-click and select HEAD and BASE to compare.

image_1ak3i7ql4mre1t6e17r717o81nlq58.png-22.9kB

The one on the left represents your code, and the one on the right represents the code on the server.

image_1ak3i9ado1p6cv6aoh460210it5l.png-117.7kB

If there are changes, remember to update to the local in time and then continue to work.

But sometimes the update will conflict, for example, you and the server have changed the same place.
At this point you need to update to resolve the conflict.

image_1ak3ihv861ceq1gko16jl1uu3mqe62.png-68.8kB

It will prompt you which file is in conflict, you just need to open that file and resolve the conflict as required.

image_1ak3ikl7a1c9dmk619r9d371mui6f.png-11.4kB

<<<<<<.mine to ==== for your code, others for the server's code. You just change to what you want.

image_1ak3iojkm7ic6911jr39021qk46s.png-5.1kB

Then select Resolve and tell SVN that I have resolved the conflict.

image_1ak3itj8gt8315rf1flij6k1l1979.png-41.3kB

The rest is the update submission operation between team collaborations, which will not be repeated here.

View logs

Choose to show the log, you can see what the people in the team have done.

image_1ak3j48bv6r9tnm821u3gpjn7m.png-30kB

You can see who is who, what time, and what. The last column of information was written when I submitted it myself. It is recommended that you fill in the submission information when submitting, so that others can see what you have done. Submitting information is also good for you, and you can see what you did after a long time.

image_1ak3j7va3jbt147j1s2thni1eui83.png-98.6kB

version rollback

If you change something, but haven't committed it yet, you can use the revert feature.
image_1ak4pcd3bpac328t5u1mas1k1v9.png-103kB
But what if we wrote something wrong and committed it? Version rollback allows you to restore files to
previous versions. Right-click to update to the version, select the version by viewing the log, and then roll back.
image_1ak3k9pl5nt0euj10eob6e1pai8t.png-21.1kB

Sometimes we need to look at previous versions of the code. At this point we can create a new folder to check out to the specified version.

image_1ak3kifgr1b1q1fv0p871f25jda9a.png-158.9kB

version control

There are several methods of version control, as follows.

  1. This is the easiest way to add version information when submitting a release build.
    image_1ak3locvo1ndq4pg1nohuhn1fh89n.png-17.1kB

  2. Tagging
    Every release should be tagged. Right click and select branch/tag. Label the to path with the version number
    image_1ak3muiav1t0o9v21a5qfnt3ut9.png-28.3kB
    image_1ak4tm0e3aal1t71r94p941h9p2a.png-80kB
    so you have a v1.0 version label.
    If you want to view a certain version of the code in the future, just switch to the past
    image_1ak3n7ai51l6b77j10811plc12ba13.png-14.9kB

Summarize

In our daily use, the most commonly used are update and commit operations. These two steps must be very skilled. The other thing you can do when you run into problems is to look at the documentation. In addition, it should be noted that all version control tools can only track text files (files that can be opened and viewed with Notepad), and don't expect SVN to record which line you changed in word. Once you encounter a word conflict, remember to carefully compare the two versions, and then resolve the conflict.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324505206&siteId=291194637