Published on

Published in: Technology
  • nice slide thx alot you helped me in a school project
    Are you sure you want to  Yes  No
    Your message goes here
  • a
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Subversion Thomas Wiradikusuma
  2. 2. Why Version Control? <ul><li>Gives a project-wide undo button; nothing is final, mistakes are easily rolled back. </li></ul><ul><li>Allows multiple developers to work on the same code base in a controlled manner. </li></ul><ul><li>Keeps a record of the changes made over time. </li></ul><ul><li>Supports multiple releases at the same time as you continue with the main line of development. No more code breeze just before release. </li></ul><ul><li>A project-wide time machine. Essential for regenerating prior releases for customer with problems. </li></ul>
  3. 3. Why Subversion? <ul><li>The developers are hard code CVS users, and are aware of its shortcomings </li></ul><ul><li>Versioning for files, directories and metadata (properties) </li></ul><ul><li>Atomic commits </li></ul><ul><li>Excellent networking support (svn, ssh, web) </li></ul><ul><li>Cheap branching, tagging and merging </li></ul><ul><li>True cross-platform support </li></ul><ul><li>Open source and free :-) </li></ul>
  4. 4. What is Version Control? <ul><li>A place to store all of the various revisions of the stuff you write while developing an application. </li></ul><ul><li>It all goes to the repository, a central place that holds the master copy of all versions of your project’s files. </li></ul><ul><li>Should be safe, secure, reliable, gets backed up regularly. </li></ul><ul><li>Now they are networked, but you can do online/offline operations. </li></ul><ul><li>Some are decentralized (BitKeeper, SVK, etc). </li></ul>
  5. 5. What Should We Store? <ul><li>Source code </li></ul><ul><li>Build scripts, scripts to create a release </li></ul><ul><li>Test data used by QA </li></ul><ul><li>DB schema </li></ul><ul><li>Project settings (when everybody’s using the same IDE) </li></ul><ul><li>Project documentation (internal and external) </li></ul><ul><li>Significant e-mails, minutes of meetings, info from the Web </li></ul><ul><li>Expensively-generated artifacts </li></ul><ul><li>Basically anything that contributes to the project </li></ul>
  6. 6. Basic Terminologies <ul><li>Working copy: local copy of all the things that we need from the repo to work on our part of the project. </li></ul><ul><li>Check out: extract to working copy. Ensures that you get up-to-date copies of the files you request and that these files are copied into a directory structure that mirrors that of the repository. </li></ul><ul><li>Commit: save changes back to repo. </li></ul><ul><li>Update: receive the latest set of file from the repo. </li></ul>
  7. 7. How Things are Organized <ul><li>At the lowest level, Subversion deals with individual files </li></ul><ul><li>Projects > Modules > Files </li></ul><ul><li>Organized into directories </li></ul><ul><li>Complex code sharing: externals (include another Subversion repo location in any directory in your project). </li></ul>
  8. 8. Where Do Versions Come In? <ul><li>Subversion stores every version of each of the files in its care </li></ul><ul><li>Subversion uses repo-wide numbering scheme (as opposed to file-specific numbering), starting from 0. </li></ul><ul><li>Usable to: </li></ul><ul><ul><li>Retrieve a specific revision of a file </li></ul></ul><ul><ul><li>Check out everything exactly as it appeared n months ago </li></ul></ul><ul><ul><li>Tell you what changed in a particular file between revisions </li></ul></ul><ul><ul><li>Undo mistakes </li></ul></ul>
  9. 9. Tags <ul><li>People are not good at numbers. </li></ul><ul><li>Assign names to a group of files (or directories or an entire project) at a particular point in time. </li></ul><ul><li>A great way of keeping track of significant events in the life of your project’s code. </li></ul>
  10. 10. Branches <ul><li>Trunk: main line of development </li></ul><ul><li>Consider the time when a new release is about to be shipped. One small sub team of developers may be preparing the software for that release, fixing last-minute bugs, working with the release engineers, and helping the SQ team. During this vital period, they need stability; it would set back their efforts if other developers were also editing the code, adding features intended for the next release. </li></ul>
  11. 11. Branches, cont’d <ul><li>Freeze new development? The rest of the team is effectively sitting idle. </li></ul><ul><li>Copy the source software out onto a spare machine and then have the release team just use this machine? What happens to the changes they make after the copy? How do we keep track of them? If they find and fix bugs that are also in the trunk, how to efficiently and reliably merge these fixes back in? And once they release the software, how do we fix bugs that customers report; how can we guarantee to find the source code in the same state as when we shipped the release? </li></ul>
  12. 12. Branches, cont’d <ul><li>Multiple parallel futures </li></ul><ul><li>The release team check in/out from the branch </li></ul><ul><li>Like having a totally separate repository </li></ul><ul><li>Each branch has its own history and track changes </li></ul><ul><li>Branches are stores as named directories, created simply by copying the trunk to a new location, using lazy copy </li></ul><ul><li>Avoid excessive branching! </li></ul>
  13. 13. Merging <ul><li>When you fix a bug in the release branch and realize that the same bug will be present in the trunk code, you can tell Subversion to work out the changes you made on the release branch to fix the bug and then apply those changes to the code in the trunk. You can even merge them into different release branches. </li></ul>
  14. 14. Locking Options <ul><li>Subversion uses optimistic locking (as opposed to strict locking). </li></ul><ul><li>Repo will not allow you to check in a file that has been updated in the repository since you last checked it out. Instead, it asks you to update your local copy of the file to include the latest repository changes before checking in. VCS will attempt to merge the repo changes with your changes. </li></ul><ul><li>Using a simple file property you can ask Subversion to enforce strict locking on individual files, such as sound, graphics, or other unmergeable files. </li></ul>