1. Project Import
Import the code from the SVN server into myeclipse/eclipse .
Requirements:
You have installed the SVN Eclipse plugin Subclipse.
Steps:
(1) Click the menu "File"/"import" to open the "import" dialog box. (can also be opened by right-clicking the package Explorer )
Figure 1 Import dialog box
(2)1 ,There is an option in the Import dialog box to check out the project from SVN svn/(This is the Chinese version, Similar to the English version), click Check out items from SVN to open the Check out from SVN dialog box.
Figure 2 SVN Checkout Initial dialog box
If you do not have a library, select "Create a new repository location" and click Next "next". Enter the repository address, as http://56.16.32.47:8001/svn/DEV/ banking /cbhb_bips , click Next ".
Figure 3 SVN Checkout 2
(3) Select the item you want to import, such as select code/trunk/cbhbp, and click Next "next". Other press the default, until "Finish" is clicked, of course, you can modify the exported "project name", "Project Location" and "Workgroup (working sets)" and so on information.
Figure 4 Selecting a project to export
Problems may occur:
(1) Inconsistent JDK version results in project error
Right-click the project/"Properties" and modify it in "Java Build Path".
(2) Inconsistent compile version results in project error
Right-click the project/"Properties" and modify it in "Java Compiler".
2. Code Synchronization
Code synchronization consists of three classes: Commit (commit); update; merge.
Commits the code that you modify locally, needs to be synced to the SVN Server, and no one on the server has modified the file.
Update refers to updating the SVN code to local, usually submitted by someone else, and you have not modified the file locally.
Merging means that when you are submitting your code, you find someone has modified the same file and submitted it to the SVN Server before you. At this point you need to merge the SVN Server's code to your local, keep both the changes, and then sync to the svn server. Remember, do not directly overwrite the changes of others, the most modified the same line of code, you should reasonably judge the final result and then merge.
(1) icon Description
Figure 5 The Package Explorer view
A) the document () is marked "*", the document has been modified, and the package () "*" indicates that the contents of the package have been modified.
b) document () "? "The presentation of new files; package () label"? "represents a new package.
Figure 6 Synchronization (Synchronize) view
A), which indicates local additions.
b), which indicates local deletion.
c), indicating that the SVN server was deleted.
d), which indicates that the SVN server is new.
e), which indicates a conflict. Local and SVN simultaneously modify the file, such files need to resolve the conflict, not directly updated.
(2) conflict resolution
When synchronizing code, prioritize conflicting files and see the following in the Figure 6 Synchronization (Synchronize) View:
Figure 7
From left to right: files to be updated, pending files, all files, conflicting files.
Click to show that this time in the code synchronization, which files are conflicting. If there is a file conflict under this view, the file for that view needs to be processed first.
Steps:
A) Click to view the conflicting file, in this example there is a conflict file.
Figure 8
b) Double-click to open the conflict file.
Figure 9 Description of the conflict file
You can see three changes, the color is not the same. If there is no red part, it is theoretically possible to update the code directly to the local, but require a synchronization code (click the small square shown in the figure) to avoid problems.
The following conflict resolution results are as follows:
Figure Ten conflict resolution effect
c) The tag file is "merged". Right-click the conflicting file and click "Mark as merged."
Figure one mark to merge
Files that are marked as merged appear in the pending file.
Figure A post-merge effect
(3) Update code
After resolving the conflict, the second part should be to update the code, click to switch to the "files to be updated" view, select the files that need to be updated, right-click, select "Update".
Figure Update Code
After you update the code, you should start the project, confirm that the system has no errors, and then proceed to the next step, "Submit code."
(4) Submit code
There are a few things to note when submitting your code, as listed below.
Note the point:
A) when committing the code, make sure the code is correct, otherwise you should not commit the code to SVN;
b) do not submit Myeclipse/eclipse Project Engineering Information when submitting the code;
c) When submitting the code, do not submit Java after compiling the file;
d) When the code is submitted, some local settings are not submitted to prevent other developers from being affected.
Click the switch to file to submit view, select the file you want to submit, right-click, and select Commit.
Figure Submit Code
3. Special Case Processing
(1) restore
After modifying the local code, you feel that the modified code is not appropriate, you can restore this function to restore the code to the previous version.
Steps: Right-click the file /Team/restore.
Figure Restore Code
(2) overwrite / update
When recovering code, "restore" is one of the ways that it restores the code to the previous version of the Code. Of course there is another way, which is "Overwrite / update", "Overwrite / Update" is in the Synchronize view. It overwrites the latest SVN code with the local code, replacing the local modifications.
The main purpose is: When you commit the code, found that the code on SVN more reasonable, or svn code on the same local, you can consider the use of "Overwrite / update 】。
Figure Overlay / update
Note: The Overwrite / update requirement myeclipse/eclipse is in theSynchronizeview.
(3) View Local repository
After the code is submitted, the other person's updates are covered with their own code ( find the person, stab him, forget it), you can "view the local repository."
Step: In thepackage Explorere View, right-click on the file /"Team"/" Show Localhistory"to open the"History "window, in the"History" The window can see the local modification history.
Map of Show Local history
Map of History
SVN usage Instructions Document