SourceForge -- create SVN

Source: Internet
Author: User
Tags svn update tortoisesvn

I. SVN introduction:

SVN (subversion) is a version management tool that has emerged in recent years and is the successor of CVS. Currently, the vast majority of open-source software
All use SVN as the code version management software.

 

Ii. Common free SVN servers

 

1. SourceForge

2. Google Code

 

 

1. Establish the svn service of SourceForge:

First go to souceforge
Register an account. After successful registration, log on to the account... Createproject... Create your own project ....

Then, the source code can be uploaded to each project and the svn service is included... In other words, you can upload files to the svn directory of your project.

File ....

Then the PC client... Tortoisesvn is recommended.
Download and complete the installation.

 

After the installation is successful, right-click the icon in the working directory and select SVN
Checkout.

Then you can see the following picture:

First, we need to fill in the repository location. For SVN, the repository location is a URL. Enter the address of the svn server... Because we use the svn service of SourceForge, we can view the corresponding URL in the corresponding project.

Next, let's take a look at the checkout directory. This field should point to your working directory. Click OK to see the following message window.

This indicates that the action is completed. Click OK and go to the directory you just created. You will see a directory named. SVN under the working directory (this directory is hidden. If your file Administrator does not set it, you will not be able to see the hidden directory)
.

SVN creates the. SVN subdirectory under your working directory and Its subdirectory. You should not go into this directory, especially do not change any content under this directory. Otherwise, SVN may not work properly.

Because the original repository is empty, our current working directory is also empty. If you are currently checkout a repository with existing content, you will see that there are many more directories and files under the working directory.

If you want to checkout the file on an existing SVN server, you only need to specify the correct URL and the name of the working directory. You can obtain the specified file and directory.


Add files and directories to Repository

Assume that all the preceding actions are correct. Now you start to develop a new program. Assume that the program you developed will be placed under the my _
Prj subdirectory. As follows:

Assume that you have edited the files and want to put them in SVN repository. Right-click the icon in the my_prj directory and choose tortoisesvn-> Add (note that the new tortoisesvn version is commit)

Tortoisesvn will display the files and directories to be added. To be added to repository. If you do not want to add files or directories to this project, do not select this project. In this way, it will not be added to repository.

After you press OK, you will see the following message window:

This indicates that the operation is successful. Note that the Add action does not actually put the file in repository. Only tell SVN to prepare to put these files in repository. At this point, if you view these files through the archive administrator, you will see a white-colored exclamation point under the document.

This indicates that the files in your working directory are not synchronized with those in repository. Now we need to add one more commit action. Put these files
In repository. You can right-click the icon in the my_prj directory or the blank space in the my_prj directory to open the following menu and select SVN
Commit.

Then, you will see the following window:

In this window, a list will be listed in the lower half to give you a clear picture of the files to be committed to repository. Similarly, if you have an archive that you do not want to commit to repository at this time, you can cancel the selected archive so that they will not be commit to repository.

At the top of the archive list is the message column, where you can enter the purpose of this commit. This is a very important field. When you commit a large number of times, you can rely on this message to know
Differences between versions. After you enter the message and press OK, the following window appears, notifying you that the specified file has been sent to repository.

You can go to the previous folder to check whether all the file icons have the following green hooks. This means that your files are correctly recorded in repository.

Sometimes, due to Windows problems, you may see that some icons do not turn green. Press F5 several times to solve the problem. If it still does not work, it indicates that your previous commit action is actually faulty. Check whether the previous commit action is correct.


Update files and directories

Why update? Most version control systems are used by many people. Therefore, some people may edit the same file. To ensure that the files in your working directory are synchronized with those in repository. We recommend that you perform the update operation before editing. Here, we assume that you have checked the file
Once. Now we need to explain how to update a check-out directory. Right-click the file or directory icon you want to update. Select SVN
Update.

Normally, you can see the window above. In this window, the files updated are displayed. If you do not see the file update information, it indicates that the file in your directory is up-to-date, so you do not need to update it.


Update to a specific version

Sometimes we need to trace back to a specific date or version, then we can use the svn update to revision function. Right-click the file or directory icon you want to update. Select tortoisesvn-> Update
To revision.

In this update window, you can choose to Update to the latest version (head ). You can also choose to update to a specified version (revision ). Of course, you may not remember the correct version number. You may only vaguely remember the approximate time. It doesn't matter. Press show
Log button to review the history.

All the actions you have done, and their dates and corresponding versions are listed in this window. Just click on the version you want to change it to a whitelist, and then press OK. This version is automatically filled in the revision field in the update window. If you press OK again, this version will be taken out to your hard disk.


Copy files and directories

Most of the time you want to have another copied directory for new compilation. After confirming that the Branch has been modified, merge it to the original major development version. For example, we are currently working
Copy contains the following directories and files:

Now, we need to create a branch for the trunk directory. Suppose we want this directory to be in D:/working/my_prj/Branch
/My_new_branch_for_testing. First, we can right-click the blank space under the trunk directory or directly under the trunk icon.

Select branch/Tag... After this project, you will see the following dialog box.

Make sure that the directory in from wc at URL is the source directory to be copied. Then, enter the path you want to copy to URL. Generally, we will put all branch in a directory. In the preceding example, Branch files are stored in the sub-directories of branch. In
You only need to enter the directory you want in the URL. If the directory does not exist, SVN will help you create it. Note that SVN uses a slash as a directory separator rather than a backslash.

Enter the purpose of your branch in log message. Press OK.

If it succeeds, you can see the following picture:

Press OK to close the window. If you go to working now
Under the branch subdirectory of copy, you will be disappointed to find that there is no specified directory under this directory. This is because you work
The copy part is still old. You only need to perform SVN under the Branch subdirectory
Update to see the new directory. The new directory has nothing to do with the original directory. You can edit it at will until you confirm all the work you should do under branch.
After that, you can choose
Merge returns to the original trunk directory or keeps it in branch.

The method for returning merge to the trunk directory is simple. In the preceding example, right-click the D:/working/my_prj/trunk directory and select merge:

The following figure is displayed:

The image consists of the following parts: from and:
It is to ask which version of branch you plan to go back to the original trunk directory. Therefore, the from and to URL fields must specify the original
Branch directory. The rest is to specify the revision range for merge. In the preceding example, we use Branch's revision
7. Start merge to the latest version under branch. You can use, dry
Run button. Try merge once. This merge will only display some messages and will not be actually updated to the trunk directory. Only by pressing the merge button will
Branch files are merged with trunk files.

The above message tells us that YYYY. cpp and xxx1.cpp under the trunk Directory have been changed. If you go to the trunk directory, you will see the two files in the modified state.

If you confirm that there is no problem with this merge, you can directly use commit to commit the two modified files back to SVN.
Repository. If there is a problem, you can directly modify the two files until the confirmation is OK, and then commit.

If everything goes well, you will successfully return Branch's file merge to trunk.


Create a tag or release

The so-called tag or release is a special version, because this version may be of special significance. For example, this version is especially milestone or release for customers.
. In fact, the tag and release practices are exactly the same as branch. Only branch may need merge back to the original trunk, while the tag and
Most of release does not require merge to return to trunk. For example, today we have a trunk version, which is regarded as version 1.0 of the software. Version 1.0 for development
It is a very important milestone. So we need to make a tag for him. Assume that

Version 1.0 is intended to be officially release to the customer or the relevant vendor, and we want to make a release Mark for it. Basically, SVN only has the concept of directory, and there is nothing
Tag usage. So you will see that on the svn menu, branch and tag are the same project. In the example of 1.0, right-click the trunk,
Select the branch/Tag project:

If the tag is successfully created, a 1.0 directory is created under the tag directory. Of course, if you go to the directory under the tag, you will not see this directory. You need to update it under the tag directory to see it.

The procedure for making a release is exactly the same as that for creating a tag. Just replace the directory of the tag with release.

As you can see, I believe everyone has realized that either branch, Tag, or release only
Copy the trunk version to another directory. SVN does not care whether this directory is branch or release. Therefore, you can use another directory name. No
Too, branch, tag, and release are the same names as agreed above in SVN. Therefore, unless you know why you did this, you 'd better follow the naming principle of follow,
This prevents new users from reading the code.

Note: In the same way, trunk is just a convention name. It does not have to be called trunk. The trunk directory shows the main development trunk.


Quick Reference

I wrote a lot of nonsense, mainly for those who have no idea about version control. If you want to know how to use a function, see the following section.

In the subsequent instructions, D:/working is used as the working directory. You can replace it with any other directory you want.


Get (checkout) Repository

  1. Open the archive administrator and enter D:
  2. Right-click the archive administrator blank space and select SVN checkout
  3. In the checkout dialog box,
    1. URL of repository: the location of the repository.
    2. Checkout Directory: the location where working copy is to be stored.
  4. If the D:/working directory does not exist, SVN will ask you if you want to create this directory. Select Yes.
  5. Then press OK to checkout the directory.


Update a file or directory

  1. Right-click the file or directory icon that you want to update from repository to working copy. Select SVN
    Update.
  2. If you want to update to a specific version, select tortoisesvn-> Update to revision. In the update dialog box, enter the version you want in the revision field. You can also use show
    Log button to view version information.

Add a file or directory

  1. Right-click the icon of the file or directory that does not belong to repository. Select tortoisesvn-> Add.
  2. Select the file to be added.
  3. Press OK.

Note: Newly Added files must be submitted (COMMIT) before they can be truly put into repository.


Submitted (COMMIT) modified files or directories

  1. Right-click the modified file or the blank space of the entire directory.
  2. Select the files or directories to be submitted to repository.
  3. Enter the message ). This message should be clear but should not be too simple. To facilitate future version tracking.
  4. Press OK.


Copy/Tag/branch/release file or directory

  1. Make sure that the file or directory you want to process is the latest version in repository.
  2. Right-click the directory or file to be processed and choose tortoisesvn-> branch/Tag.
  3. Enter the destination at the to URL.
    1. Branch: generates a branch. To differentiate development from trunk.
    2. Tag: to form a tag that represents an important milestone.
    3. Release: indicates a record of a formal release.
    4. Others: perform a copy operation ).

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.