2. Discussion point.
O Concept of version control & SVN?
O Common Function in Tortoise SVN?
O Best Practices
O Q & A
O Any Questions ??
3. 1. Concept of version control & svn
O What is version control ?
O Versioning model
O What is SVN ?
O How to use svn?
O Svn client and plugins.
4. 1.1 what is version control ?
O The management of changes to information
(physical: files).
O Allow concentrating and sharing files over the
network.
O Support authority and security.
O Cooperate member’s changes.
O Manage files with version, allow recovering of
desired version.
O Allow checking the modification.
O Support CM(Configuration Management) process.
6. 1.2. Versioning models(1/2)
O Lock-modify-unlock solution:
weak point is not allow many
persions to work on the same
file at the same time.
7. 1.2. Versioning models(2/2)
O Copy-Modify-Merge solution
(SVN recommended):
Allow many persons to work
on the same file at the same
time, but must apply file
merging before submitting.
9. How to Use Version Control
client
server
send current revision ( n )
(do some work, test)
check status any changes since revision n?
update
update your local copy with any
changes in the repo.
(resolve conflicts)
commit
(do more work, test)
save your changes and log entry
10. 1.3 What is SVN ?
O Subversion (abbreviated SVN) is a free open-source
version control system.
O Managed folders/files are placed into a repository. A
repository is much like an ordinary file server.
O Can operate across networks,which allows it to be used
by people on different computers.
14. Why use svn ?
O Sufficient features
O Free / Open Source
O Support Windows, UNIX, Linux, Mac OS
O Large community: many clients/shells (TortoiseSVN,
Syncro, SmartSVN…), many plugins (VS .NET,
Eclipse, XCode IDE…)
O Plain file formats: allow to recover data when
repository broken
O Good performance (on-debate)
15. 1.4. Svn Client and plugins
O SVN Client for Windows: SVN Plugin for Eclipse:
O (http://tortoisesvn.tigris.org) http://subclipse.tigris.org/
O
16. 2. Common function in Tortoise SVN
O Setup TortoiseSVN, grant access right
O Browse repository
O Check out a working copy
O Add file/folder to repository
O Lock/Release repository files
O Commit to repository
O Check modification
O Update working copy
O Revision log dialog
O View differences
O Clean up
20. 2.2 Browser Repository
O In Windows Explorer, right click > TortoiseSVN > Repo-
browser
O Put the repository URL into the dialog box
Login with given username and password
22. 2.3. Add file/folder to repository
O A. Without (local) working copy folder
O In Repo-browser, right click>Add folder…
O Select source file/folder to be added
=> New files/folders will be added under current
selected folder.
23. 2.3. Add file/folder to repository
B. With (local) working copy folder (recommended)
➢ Copy new file/folder to the working copy folder
➢In Windows Explorer, select new file/folder,right
click>TortoiseSVN>Add…
➢TortoiseSVN>Commit…=> New file/folder has a check
mark.
24. 2.4. checkout working copy
O SVN: Checkout (head rev.) = VSS: Get latest version
O In Windows Explorer, select working folder, right click>SVN
Checkout… OR
O In Repo-browser, select the folder to check out, right
click>Checkout…
Desired revision
25. 2.5. Lock / Release repository files(1/2)
O SVN: Checkout + Lock = VSS: Check-out
This is to avoid the conflict when another user updates the
repository while you are working on your working copy.
O How to:
In the working copy, select file to lock,
right-click>TortoiseSVN>Get lock…
=> Locked file has a lock-icon mark.
Other users will not be able to commit
until you release the locked files.
26. 2.5. Lock / Release repository files(2/2)
O This is to release the locked files for others to commit.
How to:
O Select locked file>TortoiseSVN>Release lock
Steal the locks:
O Select locked file>TortoiseSVN>
O Get lock…
O - Check Steal the locks
This way will steal other’s lock and replace by your lock. Not recommended.
It’d be better to ask the author to release his lock
27. 2.6. Commit to Repository
O SVN: Commit = VSS: Check-in
O This is to send the changes you made on working copy to the
repository.
How to:
O On the working copy, right click>SVN Commit…
O Before committing, you should make sure that your working copy is
up-to-date.
Should give
comments
28. 2.7. Check Modification
O This is to know the modification status of selected file in comparison
with that file on the repository.
How to:
O On working copy, select modified file
O right click>TortoiseSVN>Check
for modifications
The Working Copy dialog shows the
status of the selected files in
comparison with that file on the
repository.
29. 2.8. Update Working copy
O SVN: Update = VSS: Get latest version
O This is to update your working copy with new changes on the
repository.
O Periodically, you should ensure that changes done by others get
incorporated in your working copy.
How to:
O On the working copy, select folder to be updated, right click>SVN
Update…
30. 2.9 show Revision log message
O For every change you make and commit, should provide a log
message describes the meaning of your change.
O The Log Messages dialog retrieves all those log messages and allows
you to select the desired revision.
O Revision number is applied for the
whole repository.
31. 2.10 View Differences
O Compare working copy with a given SVN revision.
How to:
O On working copy, select file to compare
O Right click>Show log => Log messages dialog opened
O Select the revison to compare, right click>Compare with local copy
32. 2.11 Clean up
O If a Subversion command cannot complete successfully, perhaps due
to server or network problems, your working copy can be left in an
inconsistent state.
O It is a good idea to do “clean up” at the top level of the working copy.
33. 2.12 Status of version controlled
files/folders
O Green checkmark: normal status, under control
O Red exclamation: file has been modified since last
update and needs to be committed.
O Yellow exclamation: a conflict occurs during an update.
O Grey checkmark: this file needs to be locked
first before editing.
O Locked : file is locked. Need to unlock for
other to commit.
O Red deletion: missing file or file to be deleted
under version control.
O Blue plus: File to be added to version control.
34. 2.13 Check for conflict
O If there are any changes on the server,
then you should "update" your working copy before
"commit"-ing your changes.
35. 2.14 Resolve Conflicts
O "Conflict" means you have made changes to a file, and
the version in the repository has been changed, too.
O So there is a "conflict" between your work and work
already in the repository.
O Subversion client creates 4 files when a conflict exists.
37. 2.14 Resolve Conflict
The choices are:
(1) merge local & remote changes into one file.
(2) accept remote, discard your local changes.
(3) override remote, use your local changes.
O After resolving all conflicts, mark the file as
"resolved".
O Subversion will delete the extra 3 copies.
38. 2.14 Resolving Conflicts in Eclipse
O Use "Compare Editor" in Synchronize perspective.
O Accept or reject changes one-by-one or all at once.
39. 3. Best Practices
O Best practices for the correct-usage
O Avoid conflict over multi-user repository
O Enforce control and cooperation among team
40. 3. Best Practices(1/5)
O Give comments for the commit
O Professional working style.
O Give the meaning for the update you made.
O Help to find the desired revision quickly.
O Update latest version before committing
O To assure your update is made on the latest version of the
repository.
O Right-click>SVN Update
41. 3. Best Practices (2/5)
O Self-manage the merging, do not let TortoiseSVN to merge files
O In case there is conflict between your working copy and the
repository, you should merge file by yourself.
O Steps:
O Perform Update => TortoiseSVN creates 3 files: your original file,
the latest file from repository and the SVN merged file.
O Don’t use the merged file.
O Manually compare and merge your original file with latest file.
O Overwrite your result onto the SVN merged file.
O Commit your merged file to the repository
43. 3. Best Practices (4/5)
O Checkout-Lock-Edit-Commit-Unlock (VSS: single
checkout)
O Apply the auto need-lock property.
O How to use?
O Before editing one file, perform Get lock => file is ready
to update, also the repository file is locked so the other
cannot commit their changes.
O Commit your file after editing
O Release lock => the other can edit and commit their
changes.
O Do not use Windows Explorer to set file attributes.
44. 3. Best Practices (5/5)
O Use TortoiseSVN commands (right click, drag and
drop) don not use the Windows Explorer commands.
O This to keep the consistency between your working copy
to the repository. The actions have effect on both your
working copy and repository.
45. 4. Q&A (1/3)
How to obtain a “clean” working copy (original sources only) and exclude
.svn folders.
O Select working copy>right-click>TortoiseSVN>Export
O Provide the destination folder for the “clean” working copy
How to leave (ignore) the files/folders not in source control
O Select files/folders in working copy not in source control
O Right-click>TortoiseSVN>Add to ignore list
How to add “free” files/folders (in working copy) into source control
O Select files/folders>right-click>TortoiseSVN>Add
O Commit the working copy
46. 4. Q&A (2/3)
How to break/steal lock
O This is to break the locking on file by override the locking author.
O Check for modifications>select locked files>break lock, OR
O Right click>TortoiseSVN>Get lock, check the Steal option, OK.
O Recommend: should not use this function unless you have agreement of the
PM
Cannot login because of wrong SSL cache: clear cache
O First login to a wrong/forbidden link failed => wrong SSL is cached
O Later login (to correct link) also failed because the TortoiseSVN use the
wrong cached SSL.
O Solution: right click>TortoiseSVN>Settings>Saved data>Authentication
Data>Clear
47. 4. Q&A (3/3)
How to check out an SVN directory (recursively) to
local existing folder? (Similar to get latest version in
VSS & overwrite all local)
O Should checkout to an empty working copy.
O Existing working copy may cause file conflict or leave files not
under source control.
O How to get specific version of code from SVN?
O Select file/folder in the working copy
O TortoiseSVN>Update to revision…
O Select the option Revision, input desired revision
O You can Show log to know the log message.