Introduction to Subversion and Google Project Hosting


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Introduction to Subversion and Google Project Hosting

  1. 1. Introduction to Subversion (SVN) and Google Project Hosting Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu HI 96822
  2. 2. Basic concepts <ul><li>SVN uses a centralized repository. </li></ul><ul><ul><li>We will not cover repository administration. </li></ul></ul><ul><ul><li>Clients connect to a repository to download working copies. </li></ul></ul><ul><li>Working copies: </li></ul><ul><ul><li>Ordinary directory trees. </li></ul></ul><ul><ul><li>Contains your files plus administrative files in special subdirectories named '.svn'. </li></ul></ul>
  3. 3. Updates, Commits, Revisions <ul><li>Working copy: </li></ul><ul><ul><li>A local directory tree </li></ul></ul><ul><li>Commit: </li></ul><ul><ul><li>Upload your working copy to the SVN server. </li></ul></ul><ul><ul><li>Creates a new repository-wide &quot;revision&quot;, or snapshot of the state of the repository. </li></ul></ul><ul><li>Update: </li></ul><ul><ul><li>Make some or all of your working copy consistent with a given revision. </li></ul></ul><ul><ul><li>You can update to the </li></ul></ul><ul><ul><ul><li>latest revision </li></ul></ul></ul><ul><ul><ul><li>any prior revision </li></ul></ul></ul>
  4. 4. Review: Versions/Configurations for RCS/CVS style CM <ul><li>Each file has its own version number. </li></ul> (1.1) (1.2) (1.3) (1.4) (1.5) (1.2.1) (1.2.2) (1.1) (1.2) (1.3) 1.0.0 1.0.1 1.1.0
  5. 5. SVN has repository-wide revisions <ul><li>Each time you commit, you 'stamp' not the files you commit with a new version, but the entire repository. </li></ul><ul><li>File changes color to indicate changed contents, but Subversion doesn ’t maintain a file-based “version number”. </li></ul> r1 r2 r3 r4 r5
  6. 6. &quot;Copying&quot; in SVN is cheap <ul><li>The database backend in SVN means that you can make &quot;copies&quot; of an SVN directory structure very cheaply. </li></ul><ul><ul><li>No files are physically copied, just pointers to the files and info on which revision. </li></ul></ul><ul><li>This means that you create branches, tags, and the &quot;trunk&quot; by creating and merging directories that each contain an entire &quot;copy&quot; of an arbitrary number of files. </li></ul>
  7. 7. Trunk, Branches, Tags <ul><li>SVN project directories are structured by convention with three top-level directories: </li></ul><ul><li>trunk/ </li></ul><ul><ul><li>Represents the 'main line' of development with an entire copy of the project. </li></ul></ul><ul><li>branches/ </li></ul><ul><ul><li>Contains subdirectories, each holding an entire copy of the project. </li></ul></ul><ul><ul><li>Each branch constitutes a significant enhancement to the project that can be worked on independently. </li></ul></ul><ul><li>tags/ </li></ul><ul><ul><li>Contains subdirectories, each containing one snapshot of the project. </li></ul></ul><ul><ul><li>Each snapshot represents a &quot;public release&quot; or other archival configuration of the project. </li></ul></ul>
  8. 8. Example <ul><li><repository>/stack/ trunk/ build.xml src/ : tags/ release-1.0/ build.xml src/ : branches/ add-generics/ build.xml src/ : add-intstack/ build.xml src/ : </li></ul>
  9. 9. Trunk vs. Branch <ul><li>Trunk represents &quot;gold&quot; version of system </li></ul><ul><ul><li>Should always compile, always pass tests. </li></ul></ul><ul><ul><li>In this class, it means passing the “verify” target! </li></ul></ul><ul><li>Branches represent &quot;temporary&quot; development streams to implement significant new features. </li></ul><ul><ul><li>Allow commits to repository without breaking the &quot;gold&quot; version in the trunk. </li></ul></ul><ul><ul><li>Branches don't need to always compile, pass tests. </li></ul></ul><ul><li>You must &quot;merge&quot; a branch back into the trunk when completed. </li></ul><ul><ul><li>Or at intermediate points when branch is &quot;stable&quot;. </li></ul></ul><ul><ul><li>The longer you wait to merge, the more difficult the merge might be. </li></ul></ul>
  10. 10. Our SVN server: Google <ul><li>Google provides a free service for hosting open source projects. Includes: </li></ul><ul><ul><li>SVN server </li></ul></ul><ul><ul><li>Mailing lists </li></ul></ul><ul><ul><li>Issue tracker </li></ul></ul><ul><li>We will use Google Project Hosting this semester for all class projects. </li></ul><ul><li>Also good choice for hosting your future open source projects! </li></ul><ul><ul><li>Alternatives: SourceForge, GitHub </li></ul></ul>
  11. 11. Local SVN Client Choices <ul><li>Upcoming examples of local workspace manipulation use TortoiseSVN client program. </li></ul><ul><ul><li>Best choice for Windows. </li></ul></ul><ul><li>Other clients exist for other platforms </li></ul><ul><ul><li> </li></ul></ul><ul><li>For Mac I use: </li></ul><ul><ul><li>SmartSVN </li></ul></ul>
  12. 12. Google Project Hosting <ul><li>Home: </li></ul><ul><li>Docs: </li></ul>
  13. 13. Basic Use Cases <ul><li>A. Project source download </li></ul><ul><li>B. Basic workflow </li></ul><ul><li>D. Defining a new Project </li></ul>
  14. 14. Project Download <ul><li>Preconditions: </li></ul><ul><ul><li>Obtain the URL for the project. </li></ul></ul><ul><li>If commit access is desired: </li></ul><ul><ul><li>Obtain membership in project </li></ul></ul><ul><ul><li>Get your SVN password </li></ul></ul><ul><li>SVN 'checkout' the 'trunk' to your local computer </li></ul><ul><ul><li>Use ‘http’ URL for anonymous, read-only </li></ul></ul><ul><ul><li>Use ‘https’ URL for commit access. </li></ul></ul>
  15. 15. Project Workflow <ul><li>1. Update: </li></ul><ul><ul><li>&quot;SVN Update&quot; to make your local workspace consistent with latest version from repository. </li></ul></ul><ul><li>2. Run &quot;verify&quot; target </li></ul><ul><ul><li>Make sure your updated local version is running correctly. </li></ul></ul><ul><li>3. Edit: </li></ul><ul><ul><li>Make improvements to the Project files. </li></ul></ul><ul><li>4. Run &quot;verify&quot; target </li></ul><ul><ul><li>Make sure system works correctly before committing! </li></ul></ul><ul><li>3. Commit: </li></ul><ul><ul><li>&quot;SVN Commit&quot; to 'publish' your improvements to the repository. </li></ul></ul>
  16. 16. Creating a new project <ul><li>1. Define the new project with Google Project Hosting. </li></ul><ul><ul><li>Add initial members. </li></ul></ul><ul><ul><li>Set up discussion list in google groups. </li></ul></ul><ul><ul><li>Get your SVN password. </li></ul></ul><ul><li>2. Populate the SVN repository </li></ul><ul><ul><li>Checkout the 'trunk' directory to a newly created local directory. </li></ul></ul><ul><ul><li>Add project files/directories to that directory. </li></ul></ul><ul><ul><li>SVN 'add' those files. </li></ul></ul><ul><ul><li>SVN 'commit' those files. </li></ul></ul>
  17. 17. E. Beyond basic usage <ul><li>SVN has many other useful features: </li></ul><ul><ul><li>Using branches to isolate development </li></ul></ul><ul><ul><ul><li>Most complex part of SVN usage. </li></ul></ul></ul><ul><ul><li>SVN Blame </li></ul></ul><ul><ul><ul><li>Show who committed last version of each line in the file. </li></ul></ul></ul><ul><ul><li>SVN Switch </li></ul></ul><ul><ul><ul><li>Move between trunk, branches, tags. </li></ul></ul></ul><ul><li>These will be covered later as need arises. </li></ul>