Home > Common Problem > body text

How to use svn

爱喝马黛茶的安东尼
Release: 2020-06-10 14:02:12
Original
36079 people have browsed it

How to use svn

Usage scenario:

If a certain part of your project (here refers to the mobile client project) The version (for example, version 1.0) has been developed, tested and has been launched online. Next, new requirements are received. The development of new requirements requires modifying the code in multiple files. When the requirements have been developed for a period of time, a sudden request is received. According to feedback from users or testers, there is a major bug in the project that needs to be fixed urgently, and it is required to go online immediately after the bug is fixed. How should the bug be fixed at this time? Is the repair based on the new needs that have been developed? The answer is no, and the reason is: If the bugs are fixed on the basis of new requirements that have been developed, then the new requirements have not been developed yet, let alone tested. How can it be put online immediately (or as quickly as possible)? ! Thirdly, what should I do if the development of new features and the code for bug fixing involve conflicts with the same piece of code. Obviously, bug fixing cannot be performed based on the currently developed code. The perfect solution is to perform bug fix in the version that was completed at that time. The benefits of this are:

1: After the bug is fixed It can be launched immediately, and the launch time will not be delayed because the new requirements have not been completed or tested.

2: Bug fixes are fixed in the version that was originally launched, and the risk of causing new bugs is small. If it is in the new Fix bugs based on requirements, then new features may bring new bugs

Related recommendations: "SVN Video Tutorial"

SVN warehouse directory structure Repository:

(1) trunk

(2) tags

(3) branches

trunk (trunk|main line) branches (branch) tags (mark)

truck (trunk|main line|main branch): It is used for main direction development. The development of new functions should be placed in the main line as a module. After development is completed, if modifications are needed, use branch.

branch (branch): Branch development and mainline development can be carried out at the same time, that is, parallel development. Branches are usually used to fix bugs.

tag (tag): used for tags An available version can be marked as a version that has been released online or as a version under testing. It is usually read-only.

SVN specific operation steps: (TortoiseSVN version: 1.8.8)

1: Create a warehouse

1. Create Directory structure D:\TortoiseSVN\Repository\Repo-iOS

2. Right-click on the directory structure

---> TortoiseSVN

---> Create repository here

---> Create folder structure (Create file structure) ---> Start Repobrowser (Start repository browsing) --- > Ok

How to use svn

How to use svn

How to use svn

#2: Upload the project to SVN


Desktop right click

---> TortoiseSVN


--->repo-browser--> URL: file:///D:/TortoiseSVN/ Repository/Repo-iOS ---> Ok


---> Right-click on the trunk folder


---> Add folder...


---> Select the outermost directory of the project to be uploaded to SVN and enter the log

---> Ok

How to use svn

How to use svn

Related recommendations: "

FAQ"

3: Check Out

1. Create it anywhere on the computer A directory where the project code is stored, for example: D:\TortoiseSVN\Repository\Source

2. Check out the code to this location

How to use svn

Four: Development Cycle

1. Develop in the directory D:\TortoiseSVN\Repository\Source\trunk\MyAppProject. Note that it is on the trunk main line.

Because the project has just been established, this is developing new functions. , so it needs to be developed on the main line


2. After a period of development, after testing, it is launched to the App Store, and Android is uploaded to other application malls. Extract a piece of code from the HomeViewController file when it was launched as follows


[objc] view plain copy

View the code piece on CODE derived from my code piece

- (void) viewDidLoad {  
   [super viewDidLoad];  
   // -----------------------------------------  
    int y = 0;  
    int result = 10 / y;     
    NSLog(@"iOS APP 第一阶段开发完成了! 结果是:%ld", result);  
   // End  
}
Copy after login

3. Create a new directory: 1.0 in the D:\TortoiseSVN\Repository\Source\tags directory, submit the directory to SVN, and then right-click the directory D:\TortoiseSVN\Repository\Source\trunk\MyAppProject ---> TortoiseSVN---->Branch/tag... -----> To Path :/tags/1.0/MyAppProject and select Head revision in repository ---> OkSource/ There is no content in the tags/1.0 directory. You need to update the directory for an update operation. After the update, you will see a complete project source code saved in this directory (the source code in this directory can be regarded as a copy of version 1.0 in the trunk directory). Check viewDidLoad and trunk/MyAppProject in /tags/1.0/HomeViewController. The viewDidLoad code in /HomeViewController is exactly the same.

How to use svn

How to use svn

4. Develop new requirements for the next stage, under development

5. Users or Testers report that the application has a major bug, which needs to be fixed immediately and put online as soon as possible. At this time, the programmer needs to create a branch for MyAppProject under tags/1.0.

The operation process is as follows: Select Source/ tags/1.0/MyAppProject Right-click TortoiseSVN---->Branch/tag... -----> To Path:/branches/MyAppProject ---> Ok

Look at D at this time: There is still no content in the \TortoiseSVN\Repository\Source\branches directory, and it needs to be updated. After the update, it is found that a complete project code also appears in the directory

(this code can be regarded as tags/1.0/ A copy of MyAppProject). Note that branching and tagging are done using the Branch/tag... menu. The difference is that the directory of To Path is different. For an illustration, see the diagram of branching. However, the value of to path is different. At this time, branches The viewDidLoad code in /MyAppProject/HomeViewController is exactly the same as the viewDidLoad code in tags/1.0/MyAppProject/HomeViewController.

6. Switch the workspace, use the Xcode|Eclipse integrated tool to open the project under /branches/MyAppProject, and then debug and fix the bug on this basis. Note that the project must be opened in the branch

7. After the bug is fixed, submit the modified file first and go online with the client App. After the online is completed, tag branches/MyAppProject/ to the 1.0.1 directory (tags/1.0.1) (The operation steps are the same as step 3). After the tag operation is completed, you can see that tags/1.0.1/HomeViewController.viewDidLoad and branches/MyAppProject/HomeViewController.viewDidLoad are completely consistent. It is convenient to add a new tag to branches/MyAppProject. Next time, we will fix the bug again on this basis. So far, the bug fix has been completed; the code after fixing the bug is as follows:

[objc] view plain copy

View the code piece on CODE Derived to my code piece

- (void) viewDidLoad {  
   [super viewDidLoad];  
   // -----------------------------------------  
    int y = 10;  
    int result = 10 / y;  
    NSLog(@"iOS APP 第一阶段开发完成了! 结果是:%ld", result);  
   // End  
  
   NSLog(@"1.0 版本闪退bug 已修复, 程序出现除0异常");  
}
Copy after login

8. Next, merge branch and trunk. The steps are as follows:

Right-click branches/MyAppProject ------>TortoiseSVN

----> Merge...

---> Merge a range of revisions

----> Next ---> URL to merge from : file:///D:/TortoiseSVN/Repository/Repo-iOS/trunk/MyAppProject

----> Next

- ---> Merge

How to use svn

How to use svn

##9. The steps to merge trunks and branches are as follows,

Right click/turnk/MyAppProject ----> Merge... -----> Merge a range of revisions -----> Next


-----> ; URL to merge from: file:///D:/TortoiseSVN/Repository/Repo-iOS/branches/MyAppProject

The steps are the same as above, but the path of URL to merge from is different. After the merger is completed, check the /trunk/MyAppProject/HomeViewController/viewDidLoad method as follows:


[objc] view plain copy

View the code piece derived from CODE to my code piece

- (void) viewDidLoad {  
   [super viewDidLoad];  
   // -----------------------------------------  
    int y = <strong>10</strong>;            // <strong>可以看到branches分支中的代码已经合并到主线上了</strong>  
    int result = 10 / y;  
    NSLog(@"iOS APP 第一阶段开发完成了! 结果是:%ld", result);  
   // End  
  
   NSLog(@"<strong>1.0 版本闪退bug 已修复, 程序出现除0异常</strong>");  
  
   NSLog(@"其他同事在主线trunk中进行新需求开发...");  
   NSLog(@"其他同事在主线trunk中进行新需求开发...");  
}
Copy after login

10. At this point, the merge is completely completed. If you don’t want the source code in the branches directory, you can delete it. Then the programmer who modified the bug needs to switch the workspace to the main line and use Xcode to reopen trunk/ The MyAppProject project continues to develop new features that have not yet been completed. The SVN directory is as follows:

How to use svn##Instructions:

1. Branch development and trunk development are two completely independent processes, and both can be developed at the same time

2. Since branch and trunk development are in parallel, they can submit files modified by the current project as many times as they like

The above is the detailed content of How to use svn. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
svn
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!