TortoiseSVN: Subversion client
1 Introduction
· Team development?
· Modify the file and others are also changed? What is the content you modified?
· Save the file, can you regret it? Want to get a few days ago?
· Discover BUG, want to know when BUG is introduced?
Are these problems encountered? Then use TortoiseSvn. TortoiseSVN is the client of the Subversion. Subversion is a version control system developed for the shortcomings of CVS.
2. Basic concept
Archive repository
Subversion is a background system of version management, and its core is a file of saving data. Archive library stores data with a hierarchical file system. Customers connected to the archive can read and write data. The archive is recorded in every revision! The client can take the past version from the archive library.
Figure 2.1. Typical Server / Client Model
Version model Versioning Models
Basic Problem: Sharing data without interoperability?
Document sharing problem The problem of file-sharing
The problem of cultural sharing in cooperation development is obvious.
Figure 2.2. To avoid problems
Lock - Modification - Unlock The Lock-Modify-Unlock Solution
The Visual SourceSafe is this model.
Figure 2.3. Lock - Modification - Unlocking Program
problem:
· Lock may cause management issues: If you forget to unlock someone else.
· Lock causes unnecessary serial homework.
· Lock can cause security issues.
Copy - Modification - Merge The Copy-Modify-Merge Solution
Subversion and CVS, etc. use copy-modified-merge models. Project members read personal work copies from the archive library, all project members work in parallel, and then combine together to form a new version (Version).
Figure 2.4. Copy - Modification - Merge Solution
Figure 2.5. ... Copy-modify-merge contractue
If the modification does not overlap, TortoiseSVN automatically merges. Modify overlap causes a conflict. Conflicts can only be modified by manual!
This model seems to be very confusing, but it is actually very easy. Solving the time of conflicts is larger than the time waiting for locking. The best way to resolve conflicts is to communicate.
Actual operation Subversion
Work Copy Working Copies
Subversion's work copy is the local directory tree containing files, which can be used as the tree structure of the general directory! The new file "release" to the archive after work.
Working copies include a special subdirectory created and maintained by Subversion, which saves important information. Don't delete this directory!
For example, assume that your archive contains two software items: Paint and Calc.
Figure 2.6. Archive file system
Get a work copy with Checkout.
Repository URLS: Archive URL
Subversion's archives are got with different methods: local disks, network protocols, etc.:
Table 2.1. Repository Access Urls
Schema
Access Method
File: ///
Local Disk.
HTTP: //
Transmit through Apache.
example:
File: /// C: / SVN / Prj / Template,
File: /// C: / SVN / Prj / Template / DIST
C: / svn / prj / template is the directory of the archive, dist is the sub-directory name of the archive http: // build: 88 / prj / template
http: // build: 88 / prj / template / dist
http: // build: 88 is the URL set by apache, PRJ is the location of the Apache, Template is the archive name, dist is a directory name
Version revisions
SVN Commit operation is sent to the modification. After the archive is sent, create a new state in the file system tree, called the version Revision. Each version is an increasing natural number.
Figure 2.7. Archive
Global version number
The version number represents the entire archive instead of a single file!
How do work Copy track files?
Subversion will record the following two management information in .svn /:
· Work version Working Revision
· Time updated from archive library.
Through this information, after exchange information with the archive library, the Subversion can draw four states of the file:
l Unmodified, new version, delivery is invalid
l Local modification, new version, can be sent, update invalid
l Not modified, but in the archive library, it has been modified, expired, sent to the delivery, can be updated
l Local modification and has been modified in the archive library. First update, modify the conflict, then send it.
3. Server settings
Apache-based server
This is the best way to set the Subversion server. advantage:
l Use WebDAV
l Use the browser to browse the archive library
l authentication
l security
Local archive
Create a file with TortoiseSVN
Figure 3.1. Without version controlled folder TortoiseSVN menu
1. Enter the resource manager
2. Create a subdirectory of the archive, such as C: / SvnRepository.
3. Right-click TortoiseSvn-> here in the new directory. Create Repository Here ....
It can be created in two formats of FSFS and BDB.
Note: Do not edit the files in the archive!
Local entry: file: /// c: / svnrepository /
Archivery backup
The easiest way is to back up the archive folder!
Recommended approach:
Svnadmin HotCopy Path / TO / Repository Path / To / Backup - Clean-Logs
4. Daily application guide
Operate TortoiseSVN
Figure 4.1. TortoiseSVN Right-click Menu
All TortoiseSVN commands can be executed in the right-click menu of the resource browser.
Certification
If the file is set, the authentication dialog box will pop up.
Figure 4.2. Certification dialog
If you use Windows Domain authentication, you need to include domain names, such as Mydomain / Johnd.
Data Import Archive Importing Data INTO A Repository
Archive Structure Repository Layout
Establish a archive structure according to different needs:
1. Create a new empty folder.
2. Create a directory structure - do not place the file first!
3. Right-click menu, click Refused ... (Import ...) Add the structure to the archive.
Note: The name of the folder does not return to the archive.
Browse the archive structure directly through the archive browser (REPO BROWSER).
IMPORT
Before putting the project files into the archive library, advance to the following: 1. Delete intermediate files that are not related to the project, such as the generated temporary file * .Obj, etc. If the ignored file type is set, or the ignored directory is not deleted.
2. Organize files in the folder.
Go to the project top folder in the resource browser, right-click getting the shortcut menu, select the return ... (import ...), the dialog box:
Figure 4.3. Rebate dialog
Enter the URL of the warehouse in the dialog.
Import Message as record information.
note
Just click OK TortoiseSVN will join the files within the entire directory and directory to the archive. The name of the top folder will not be added to the archive, but the names of other subfolders are added to maintain the structure of the archive. The project's documents are now in the file version control. Please note: The current local project folder is not under version control! To get version control, you must take the Checkout file to get a copy!
Special file Special Files
Sometimes you have a file that contains user-specific data needs to be under version control, which means that each developer needs to modify it to adapt to his local settings, and users have to save this file every time, so for this class. Document is very difficult to version control.
Use the template file for this, create a total file, which contains all developers need information, add it to version control, each developer can remove this file, copy and rename it, and then modify it. Files do not need to be added to the version control can be ignored by setting the Subverty SVN: IGNORED.
Take out Copy Copy Out A Working Copy
Removing from the archive library (Checkout) can get a copy.
In the resource browser, select the copy of the working directory, right-click the shortcut menu, select C out ... Checkout ..., the dialog box will appear: (if the directory has been under version control, it is not removed but update ( Update) and delivery (commit))
Figure 4.4. Take the dialog
If the folder does not exist, it will be created automatically.
note
You can only take the file into an empty directory. If you want to take out the new file, Subversion will report an error. You can only remove the file to another directory or first delete the existing source file and then perform it.
Exporting Exporting
If you don't want to include .svn, you can turn the archive library to an empty directory. At this time, all files are not in version control. Method: Right button, select TortoiseSVN-> Remit out ... (export ...).
Status Information Getting Status Information
You can know the status of the file by the icon: modify / new / delete / rename.
icon
Figure 4.5. Resource Browser Displayed Icon
Newly removed work copy. The Subversion status is normal NORMAL.
The file has been modified and needs to be sent to the archive. The Subversion status is modified Modified.
After updating the file, your modification conflicts with others. The state is conflict Conflict.
The version-controlled file or folder will be added. The status is new added.
File (clips) will be removed from version control, version control will ignore these files (clips). The status is to delete the deleted.
Archive State STATUS of the Repository
Figure 4.6. Check update
Want to know which files have been revised? Use check updates .. (check for updates ...) command. The pop-up dialog will display your modifications in your modification or file in the archive, which checks if there is conflict before updating. Send a commit .... command can also be used to display local modifications, if you don't want to actually be sent to the archive, click Cancel Cancel.
Update someone else's change to your work copy
Figure 4.7. Progress dialog for updated
Sometimes you want to combine someone else to your local working copy. The process of modifying the local process from the server is updated Updating. Update may be a single file, or a set of files, or a whole directory. Select the file or directory to be updated in the resource browser, right-click and select Update Update, others' changes will be merged into your local file, and the changes you do are saved in the same file. At this time, the archive is not changed, ie, is only available locally.
If you change the same part and other people, the change is different, it will generate conflict in the update process. Conflict in the dialog box with red, double-click to resolve conflicts with an external editor.
TortoiseSVN also allows you to update your work copy to the specified version. Use the updated to the version update to revision ... command, enter the specified version number in the pop-up dialog box.
note
If you update to the specified version, then send it to the Out of Date error! If you want to revoke the modification and start working from the previous version, you must use the change of the Change of the Revert Changes from this revision command since this release from the Show Record dialog box, or use the Merge ... menu in the shortcut menu ... menu command.
Updated to version update to revision ... command allows you to restore to a low version. For example, your work directory version is 100, you want to recover to version 50-Directly fill in the recovery dialog box to recover to version 50. Typically, do not restore a single file, indeed need, and select the Save Version to Save Revision to ... command from the Record Dialog (LOG).
Resolving conflicts resolving conflicts
Sometimes you have conflicts from the archive update file. Conflicts are generated in two people to modify a certain part of the file. Solving conflicts can only be relying on people rather than the machine. When you create a conflict, you should open the conflict file and look for the line starting with <<<<<<< The conflict part is marked:
<<<<<<< FileName
Your Changes
=======
Code merge from repository
>>>>>> Revision
Subversion generates three additional files for each conflict file:
Filename.ext.mine
Local file before updating.
Filename.ext.roldrev
You make changes to the foundation version.
FILENAME.EXT.RNEWREV
The latest version obtained from the archive will be updated.
Use an external merge tool or an editing conflict edit control command using shortcut menu to resolve conflicts. Then execute the resolved command from the shortcut menu, and send the change to the archive. Note that the resolution command does not resolve conflicts, but only deletes filename.ext.mine and filename.ext.r * files and allow you to send it.
Change to Archive SENDING Your Changes to the repository
This process is sent to committing. Before sending, you need to confirm that your copy is the latest. Use Updates or first check the check for updates to check the changed file. If your work copy has been updated and there is no conflict, you can use the delivery process in the shortcut menu.
Figure 4.8. Send a dialog
If a file does not want to cancel the check box under version control. Documents that do not need to be controlled in the delivery box
Many do not need version control files such as OBJ files, etc., in the delivery dialog, the solution:
• Add files (or wildcards) that do not need to be controlled to the exclusive file list in the server-side editing configuration file CONFIG. Its impact is global.
· Add files to the SVN: Ignore list by shortcut menu command add to ignore list. Only affect this directory.
Figure 4.9.
Add new file or directory Add new Files and Directories
Figure 4.11. Join the shortcut menu
New files or folders in development, if you need to join the version control, choose to join Add; if you don't want to join the version control, choose Add to ignore the list Add to ignore List
Ignoring Files and Directories ignore files and directories
Figure 4.12. No version control shortcut menu
Most items will have some files (clips) do not require version control, such as compilation * .Obj, * .lst, etc. Every time, TortoiseSVN prompts those files that do not need to be controlled, it is very annoying.
It is best to add an ignore list in the project.
Global Ignore List The Global Ignore List
Another way to ignore the file is to join the global ignore list Global Ignore List. The global ignore the list is the client feature, which affects all items, but only works on the client PC. Usually use SVN: Ignore will better work because of all customers.
Delete, rename, and mobile deleta, renaming and moving
From the shortcut menu to the TortoiseSvn submenu into delete, change name, etc.
Figure 4.13. Explorer Context Menu for Versioned FILES
If you want to move the file in your work:
1. Select the files and folders to be moved;
2. Press and hold the left button to drag the Right-Drag file (clip) to the new place within the tracking copy;
3. Loosen the left button
4. Select Move Files in Subversion to Here in the pop-up menu.
If you delete a file in the resource manager, you did not delete it in version control, the delivery dialog will prompt these files and let you remove them in version control before delivery.
Undo modification UNDO CHANGES
If you want to revoke the change since the last update, select the file, the left button Right Click, select Reverter Revert in the TortoiseSVN submenu of the shortcut menu, select the file you want to restore in the dialog box, click OK.
Figure 4.14. Recovery dialog
Revocation of changed change undoing change consists of HAVEEN COMMITTED
Rehabilitation Revert only revokes local changes without revoking the transferred file changes. If you want to revoke all changes to a version, you can process it from the version record dialog box.
Revision Log Dialog Version Dialog
For each change, you must provide changes to the changes in order to find why / how to change it later. Record dialog
The Record Dialog box displays all record information and is displayed in 3:
· The UF display version number, including the date, delivery person, etc.
· Singge display the full record of the selected version.
· The base shows the list of files for this version.
A shortcut menu is also available in Jujia!
Popked record dialog
Figure 4.15. Record dialog
Popked the way the log record dialog box:
· From TortoiseSvn Subcurity Menu
· From the property page
· Update the progress dialog. Branch / tag Branching / Tagging
The role of version control is to isolate change into an independent direction, called branch branch. Branch is used to try new features before the main release.
Another feature is to mark special versions to re-create an environment at any time. This process is called tagging.
Subversion does not have specially used for branch and tag, but instead of Cheap Copies. Cheap Copies is a bit like connecting to links.
Before creating BRANCH / TAG by a working copy, you must confirm that the file has been updated.
Create Branch / Tag is very simple:
Figure 4.18. Branch / Tags dialog
From the job catalog parent folder point, select Branch / Tag Branch / Tag ..., enter the URL of the branch / mark path in the archive library, enter tags / tagname where the TRUNK is entered, here TAGNAME may be ProjectName_v1 .10.
C: / SvnRepository / Trunk / Projectname / ...
C: / svnrepository / trunk / annotherproject / ...
C: /svnrepository/branches/projectname_specialdebugbuildbasedon_v1.09/
C: /svnrepositname_v1.10
Click OK, Subversion created a Cheap Copy within the directory of your selected file. Creating BRANCH / TAG does not affect your working directory.
Take out or switch ... To checkout or to switch ...
... this is really a problem! Since Checkout takes out all the data in the branch, turn to Switch ... just the data that changes in your working directory.
In order to work on new work, you can:
· Remove Checkout again. You can take any places on your local hard drive.
· Convert to newly created archive copy. Simply switch Switch ...
Enter the URL of your branch in the dialog box below, keep "Head Revision" click OK, and your working directory will switch to new branch / tag Branch / Tag.
Switching and updating, will not lose your changes in local, but will be incorporated in unrelated modifications.
Figure 4.19. Switch dialog
Branches and tags of different points:
• Tagging static snapshots for creating a special phase of the project - no longer used for development - and branches are used to develop. This is the reason we recommend using / trunk / branches / tags.
• If you modify and send it on a working copy, the modification of the branch is reflected on the branch instead of the trunk. .
Combine branches into the backbone
Figure 4.20. Merger Dialog
(slightly)
Create and apply Patch Creating and Applying Patches
If anyone can modify, the project will be endless, never stabilize. How to do it? Through "patch patch"! The patch is sent to the writable development team, they first review the patch, and then decide whether to send to the archive.
The patch file only shows the difference in work copy and base version.
Creating a patch file creates patch files
First you need to test if your changes are correct, then use the creation of patch CREATE PATCH ... instead of using the transfer commit ..., this will create a file containing the change.
Applying a patch file set with patch files
Relocate a Working Copy
Figure 4.21. The relocate dialog
If you modify the location for some reason, you need to use reposition commands. Archive Browser The Repository Browser
Work directly on the archive!
Figure 4.22. Archive Browser
After entering the archive browser, use the shortcut menu!
Who moved my cheese? Who Changed Which Line?
Figure 4.28. Note / Condemnation dialog
Sometimes you don't just know that the code changes, you must also know who is changed! Use the chasing roots (condemnation) Blame ... you can! Translation of Blame into a condemnation, it means that it is just chasing the source
Figure 4.29. TortoiseBlame
Use TortoiseBlame in TortoiseSVN to see the modified history very conveniently
Final STEP last
TortoiseSVN is an open source project that can get the latest source code via http://svn.collab.net/repos/tortoisesvn/. These source code is an excellent model we have learned!
Enjoy it!