TortoiseSVN Detailed Operation Guide

There is a personal public account at the bottom of the article: Xiao Zheng, who loves technology. Mainly share development knowledge, if you are interested, you can pay attention. Why share? There is no need for others to step on the pits that have been stepped on, and replaying the game by yourself can also deepen the memory. Benefiting oneself and benefiting others is the so-called win-win situation.

                                                                              Xiao Zheng who loves technology

1 Introduction

Consider the following situations:

  • Do you play on a team?
  • You modify the file and others are modifying it. What you modified is lost?
  • You saved the file but regretted it, and want to restore the file to the state before modification?
  • Do you want to be able to view a file's past lives?
  • You found a bug in your project and want to file a case to investigate when it happened?
  • Do you want to quickly compare the difference between the young and middle age of a file?

If you have encountered these problems, then use TortoiseSVN. TortoiseSVN is a client for Subversion. Subversion is a version control system developed for the shortcomings of CVS

2. Basic concepts

2.1 version library Repository

Subversion is the background system of version management, and its core is the "version library- repository " for saving data. Repositories use hierarchical "file-directory" filesystem numbers to store data. Clients connected to the repository can read and write data. The repository records every modification you make! Clients can retrieve any past version from the repository.
A typical server/client model is shown below:
Insert image description here

2.2 Icon Overload

One of the most obvious features of TortoiseSVN is icon reloading, which is displayed on your working copy files. You can see at a glance that the file has been modified. Depending on the Subversion state of the file , the reload icon
is different.
Explorer showing overloaded icons:
Insert image description here

Explanation of the meaning of each icon:

Insert image description here

A newly checked out working copy is reloaded with a green checkmark. Indicates that Subversion status is normal.


Insert image description here

After you start editing a file, the status changes to Modified and the icon reloads to a red exclamation mark. This way you can easily see which files have been modified since you last updated your working copy and need to be committed.


Insert image description here

If there is a conflict during the submission process, the icon turns into a yellow exclamation mark.


Insert image description here

If you set the svn:needs-lock property on a file, Subversion will make the file read-only until you acquire the file lock. Read-only files have this overload icon to indicate that you must obtain a lock before editing.


Insert image description here

If you hold a lock on a file and the Subversion status is normal, the reload icon reminds you that if you are not using the file, you should release the lock and allow others to submit changes to the file.


Insert image description here

This icon indicates that some files or folders under the current folder have been scheduled to be deleted from version control, or that a controlled file under the folder is missing.


Insert image description here

The plus sign tells you that a file or directory is scheduled for version control.


There is no icon overloading for uncontrolled files. This is done because the number of icon overloads is limited by the system and should be used sparingly. In fact, you will find that not all icons are used on your system. This is due to Windows limiting icon reloads to no more than 15. Windows uses 4 itself, leaving 11 available for use by other applications. If you use TortoiseCVS at the same time, there will not be enough space, so TortoiseSVN hopes to be a "good citizen™" and limit its own use, leaving opportunities for other applications

2.3. Right-click menu

All TortoiseSVN commands are executed through the Windows Explorer right-click menu. Right-click a file or folder and most menu items will be displayed directly. Whether a command appears depends on whether the file or folder or their parent folder is version controlled.

Right-click menu of a directory under version control:

Insert image description here

2.4. Drag and drop

When you right-click and drag a file or directory to a new location in the working copy, or when you right-click and drag a non-version-controlled file or folder to a version-controlled directory, other commands can appear in the right-click menu.

2.5. Repository Browser

TortoiseSVN 's version library browser is similar to Windows Explorer. In the version library browser, you can view the structure and status of the version library.

TortoiseSVN”->“browserClick the right mouse button and select " " in the pop-up menu

In the pop-up repository URL address dialog box, enter the repository URLaddress you want to view:
Insert image description here
click "OK" to open the repository browser:
Insert image description here

  • In the repository browser you can perform operations such as copying, transferring, renaming, etc., directly on the repository.

  • Enter the URL address of the repository and the version number you want to view at the top of the repository browser window . Specific versions can be opened.

  • You can also use drag and drop in the repository browser. If you drag a folder from the resource manager to the repository browser, then the import function of the folder will be implemented. One thing to note is that when importing multiple files, they must be dragged in separately one by one

  • If you want to move a file in the repository browser, just left click and drag to where it wants to go. If you prefer to copy the file, use this to hold down the left button and drag. The operation is the same as in the resource manager, and the pointer is "incremented" to mark when copying.

  • If you want to copy/move a file or folder to a new location and rename it, you can right-drag or
    right-drag the file instead of left-clicking. This will display a dialog to rename the file or folder
    .

  • Right-click menu
    Right-click on a file or directory in the repository browser, different menus will appear, and these menus provide a wealth of functions.

Insert image description here

3. Daily operation

3.1. Project storage Import

The so-called Import is to submit the project files that want to be version controlled locally to the version library of the server. At this time, an empty version library is only created on the SVN server, and does not contain any project files.

Before importing the project into the repository, the following should be done:

  • Create a new temporary directory, and copy the directories and files required by the project to this temporary directory.
  • Delete all files not required for building the project
  • Organize files within directories and subdirectories

Select the temporary directory, right-click the mouse, and select from the pop-up menu TortoiseSVN”->“Import. The project import dialog box will pop up:
Insert image description here
URL of repository

  • The URL to import the project to the repository can be entered manually, or you can click the button at the back to open the repository browsing dialog box and select the desired repository.

Import mesage

  • Enter commit log information. Easy to view later.
  • After finishing, click the "OK" button, and TortoiseSVN will import the complete directory tree and its contents of all files in the temporary directory into the repository.
  • The folder name of the temporary directory will not appear in the repository, only the contents under this folder will appear in the repository. Now this project is stored in the repository and is version controlled.Please note that the files in the temporary directory you use to store the imported files are not version controlled! You need to check out the version you just imported in order to get a version-controlled working directory

3.2. Check Out the working copy

The so-called Checkout refers to obtaining all the files stored in the version library specified by the SVN server. These files are stored in the local working copy directory and are managed by the version control system. SVN 's Checkout and
Visual Source Safe 's Checkout have completely different meanings. VSS's Checkout refers to checking out and locking a certain file.

Check Out of SVN is used when connecting to the SVN library for the first time

Operation method:
Step 1: Create a new directory
Step 2: Right-click on the directory and select " SVN Check Out" in the pop-up menu:
Insert image description here
Step 3: In the pop-up Check out dialog box, select the URL of the repositoryURL of repository path at The URL address of the repository.
Insert image description here

Checkout directory
local working directory.
After filling in, click the " OK " button, andthe contents of this directory on the SVN service will be checked out to the newly created working directory above.

3.3. Export project

The so-called Export is to store the project files on the server in the local directory. These files exported to the local directory are out of the control of the version control system. In general, a "clean" project file is required in order to make an installer.
Operation method:

Step 1: Create a new directory Step 2: Right-click on the directory and select " "
in the pop-up menuTortoiseSVN“-> “Export

Insert image description here
URL of repository
The URL address of the repository, which can be filled in manually, or click the button at the back to open the repository browser to search.

Export directory
exports to a local directory.


Version to be exported by Revision :
HEAD revision latest versionThe version specified by
Revision , if you can't remember the version number, you can click the " Show log " button to find it.

After the settings are completed, click the "OK" button to export all files including directories in the selected directory to the local directory.

3.4. The difference between Check Out and Export

After obtaining the version through check out , the obtained file is still under SVN version control.
After the export version is exported, the exported file is out of SVN version control.

3.5. Add files

Copy the files or directories to be added to the newly created directory above, then right-click on the files or directories and select "" in the pop-up menu. The following dialog box will pop up TortoiseSVN”->“Add”
Insert image description here
:
Insert image description here
SVN will display the files and directories to be added, which can be added as needed. Select the file or directory to add.

Click " OK " to add the file to SVN .

In the resource manager, there is a white exclamation mark with a red background on the icon of the file or directory to be added. Indicates that the files in the working directory and the files in the repository are not synchronized.

Explanation: The Add command just tells the SVN client that these files will be included in the version management, and these changes are not submitted to the SVN server. If you want to submit them to the version library, you need to execute the " SVN Commit " operation.

3.6. Modify files

Open the file in the working directory and modify it directly. After the file is modified, the icon of the file will change.

3.7. Delete files

Select the file or directory to be deleted, right-click the mouse and select“TortoiseSVN”->“Delete”

Insert image description here
After deleting in this way, the icon of the file or directory will change accordingly. At this time, only the deletion action is recorded in the local working directory, and the file on the SVN server has not been actually deleted. Only after executing Commit , the file or directory on the SVN
server will actually be deleted.

Note: Do not use the " Delete " key or to delete files, otherwise, the SVN client will not save the delete operation, and will not be able to submit the modification.

3.8. Abandon modifications

After adding files, modifying files, or deleting files, if you find adding errors, modifying errors, or accidentally deleting files, you can click the right mouse button and select in the pop-up menu if you want to abandon the modification.“TortoiseSVN”->“Revert”:

Insert image description here
In the pop-up dialog box, select the file to be restored, and click the "OK" button to restore to the state before modification.
Insert image description here
Note: Revet can only undo local modifications, but cannot undo changes that have been submitted (Commit).

3.9. View changes

Before submitting, you can check which files have been modified locally or on the server. Sometimes we make modifications to many files of the working copy, which are located in different subdirectories. Another situation is that our working copy has not executed the Update command for a long time. We want to see which files in the working copy have been modified. At this time, we can right-click on the top directory of the working copy and select the pop-up menu. choose from“TortoiseSVN”->“Check for modifications”

Insert image description here

The following dialog box appears, listing the modified files:
Insert image description here

3.10. Submit to the database

After confirming that the file is modified correctly, you need to submit the file to the repository of the SVN server. Right-click the file or directory that needs to be submitted, and select " SVN Commit" in the pop-up menu :

Insert image description here
The following submission confirmation dialog box pops up:
Insert image description here
In the above dialog box, you can fill in the submission information as required, and you can also select the file to be submitted. After confirming, click " OK " to submit the modified file to the database.
After the submission is completed, the following information is displayed:
Insert image description here

3.11. Get the latest version

To get the latest version for the first time, you need to use the Check out command.

When there is already a working copy locally and you need to get the latest version, you need to use the Update command of SVN , which is equivalent to the Get Last Version command of VSS . The operation steps are as follows: Right-click on the working directory and select " SVN Update " . Note: If there are modified files or deleted files in the working directory, and these changes have not been submitted, when executing the Update command, These files will not be updated. If you want to abandon all current changes and update the local file to the latest version on the SVN server, you need to execute the " Revert " command first, abandon all changes, and then execute the " Update " command.

Insert image description here

3.12. Get a specific version

Sometimes we need to go back to a specific date or version to view the file content at that time, which requires the use of the Update to revision command of SVN . Click the right mouse button on the file or directory you want to update, and select “ ” from the pop-up menu :
TortoiseSVN”->“Update to revision”

Insert image description here
The following Update dialog box pops up:
Insert image description here
In the Update dialog box, you can choose to update to the latest version ( HEAD ), or you can choose to update to a specific version ( Revision ). If you can't remember the exact version number, you may only vaguely remember the approximate time. It doesn't matter. Click the " Show Log " button to review the history:

Insert image description here
All the changes that have been done, their dates and corresponding versions will be listed in this dialog box, select the required version
, press " OK ", and this version will be automatically filled in the Revision of the Update dialog box , and click " OK ", the specific version you selected will be fetched into your working directory.

4. FAQ

Situation 1. Report "403forbidden" error

Answer: Permissions problem means that you do not have permission to access. Please contact the administrator. In addition, check whether the case of the input path is consistent. SVN is case-sensitive.

Situation 2. 400 bad request
Answer: Usually it is caused by anti-virus software, please add SVN to your trusted zone.

Situation 3. No repository found
Answer: The access path is wrong, please check the URL address you visit.

Situation 4.405 Method not allowed
Answer: The access interface is blocked.

Situation 5. Out of date
Answer: It means that the content of the repository is newer than what you submitted. The processing method: first update the content of the repository, and then overwrite it with your local file before submitting.

Situation 6. Submission failed, a folder text status is "obstructed" and prompts "Please perform "cleanup" action".
Answer: The reason for this state is unknown, and the following solutions can be followed:

Solution:
1. Back up the folder with the exclamation mark.
2. Create a new folder and check out the latest version (the version without the problem).
3. Replace the .svn folder in the folder with the problem with the latest version. .svn folder, pay special attention to completely deleting the .svn folder under the problematic folder and then replacing it to ensure that the version information of this folder is restored to the latest version.
4. Perform cleaning
5. Submit successfully

Guess you like

Origin blog.csdn.net/weixin_43304253/article/details/132807097