• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Intro To Subversion Handout
 

Intro To Subversion Handout

on

  • 4,706 views

How to get started using subversion, and a cheat sheet of svn commands

How to get started using subversion, and a cheat sheet of svn commands

Statistics

Views

Total Views
4,706
Views on SlideShare
4,705
Embed Views
1

Actions

Likes
1
Downloads
61
Comments
0

1 Embed 1

http://www.lmodules.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Intro To Subversion Handout Intro To Subversion Handout Document Transcript

    • Introduction to Using Subversion Documentation online •Subversion Book - http://svnbook.red-bean.com/en/1.4/svn-book.html •Quick Start Guide - http://svnbook.red-bean.com/en/1.1/ch01s07.html •Learn Linux in 10 Minutes - http://freeengineer.org/learnUNIXin10minutes.html Set up a Repository Repository Hosting Services •Free ◦Google - OSS only, WebSVN included, code.google.com/hosting ◦My Version Control - Trac included, myversioncontrol.com ◦OpenSVN - Trac included, opensvn.csie.org •Pay Services ◦SVN Repository - $4/mo, Trac included, svnrepository.com ◦Versionshelf - $7/mo, WebSVN included, versionshelf.com ◦DevGaurd - $8/mo, WebSVN and Trac included, devguard.com Web Hosts that include Subversion •Dreamhost – dreamhost.com •Geek ISP – geekisp.com •WebFaction – webfaction.com Front-end Tools •Windows ◦Tortoise SVN – tortoisesvn.tigris.org [ 1 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • •Mac ◦Versions – versionsapp.com •Cross-platform ◦SmartSVN – syntevo.com/smartsvn ◦RapidSVN – rapidsvn.tigris.org How to structure your repository When you first set up your new repository, it will likely be a blank slate. The first thing you will want to do is create the following directories in the root your new repository: •trunk •branches •tags The trunk directory will hold your primary development, while the branches directory will hold sub- directories that will be copies of trunk for the purpose of branching development. The tags directory will contain sub-directories that are copies of either trunk or one of your branches that will record a snapshot of a significant moment of your development. Note: If you do not structure your repository this way, you may have problems using tools that integrate with your subversion repository. Committing tips Always write clear and comprehensive commit messages Commit small and commit often Avoid putting too many tasks into one commit. Break up your theming tasks into design objects, and commit after styling each object. Commit each bug fix as its own commit, even if it is a one line change. The reason behind this is to maximize the ability to find bugs, and remove undesired changes. If you found a change broke something in IE6, you can then revert that change more easily when it is not bundled with other arbitrary tasks. Another reason to commit small batches is to make it easier to read what happened on a code level. It gives your coworkers, and yourself, an opportunity to understand the purpose for a change. Overall, the best thing to do is commit small and commit often. [ 2 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • Command Line Guide Import your existing theme into the repository Command: svn import path/to/theme http://svn.example.com/repos/mytheme/trunk -m “message” Example: [themes]$ svn import mytheme http://svn.example.com/repos/mytheme/trunk -m “Importing theme” Adding mytheme/layout.css Adding mytheme/mytheme.css Adding mytheme/mytheme.info Adding mytheme/template.php Adding mytheme/theme-settings.php Committed revision 1. [themes]$ Checkout your repository Command: svn checkout http://svn.example.com/repos/mytheme/trunk Example: [themes]$ svn checkout http://svn.example.com/repos/mytheme/trunk ./mytheme A mytheme/layout.css A mytheme/mytheme.css A mytheme/mytheme.info A mytheme/template.php A mytheme/theme-settings.php Checked out revision 1. [themes]$ [ 3 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • Get the latest code from the repository Command: svn update Example: [mytheme]$ svn update U pdtheme-content.css U pdtheme-header.css A images/searchBar.png U node.tpl.php U template.php Updated to revision 2491. [mytheme]$ Symbol meanings: •U – Updated •A – Added the file •D – Removed the file •G – Merged your modifications into the update •C – Update conflicted with your modifications Viewing modified files Command: svn status Example: [mytheme]$ svn status ? pdtheme-blocks.css M pdtheme-content.css ! images/silhouette.png A images/accent.jpg D images/q.png M node.tpl.php [mytheme]$ Symbol meanings: •M – Modified file •A – Newly added to svn •D – Newly removed from svn •? – Unknown to svn (use svn add) •! – Missing file (use svn delete) [ 4 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • •C – Conflicted file (needs manual resolution) [ 5 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • Reviewing changes to files Command: svn diff Alternate: svn diff | less -S Example: [mytheme]$ svn diff Index: pdtheme-content.css =================================================================== --- pdtheme-content.css (revision 2491) +++ pdtheme-content.css (working copy) @@ -263,7 +263,7 @@ *************************************************************************** ***/ .node-inner { - padding:0.5em; + padding:1em; } .body-node h1.title { [mytheme]$ Adding new files Command: svn add path/to/file Example: [mytheme]$ svn status ? images/accent.jpg [mytheme]$ svn add images/accent.jpg A images/accent.jpg [mytheme]$ svn status A images/accent.jpg [mytheme]$ Removing deleted files Command: svn delete path/to/file Example: [mytheme]$ svn status ! images/silhouette.png [mytheme]$ svn delete images/accent.jpg D images/silhouette.png [mytheme]$ svn status D images/silhouette.png mytheme [mytheme]$ [ 6 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • Reverting modifications Command: svn revert path/to/file Example: [mytheme]$ svn status M pdtheme-content.css M node.tpl.php [mytheme]$ svn revert node.tpl.php Reverted 'node.tpl.php' [mytheme]$ svn status M pdtheme-content.css [mytheme]$ Committing Command: svn commit -m “message” Example: [mytheme]$ svn commit -m "Theming display of taxonomy terms" Sending pdtheme-content.css Sending node.tpl.php Transmitting file data ... Committed revision 2495. [mytheme]$ Going back to previous versions Command: svn update -r [commit number] Example: [mytheme]$ svn update -r 2450 G pdtheme-content.css U node.tpl.php U views-view-unformatted.tpl.php Updated to revision 2450. [mytheme]$ Symbol meanings: •U – Updated •G – Merged your modifications into the update •A – Added the file •D – Removed the file •C – Update conflicted with your modifications [ 7 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • Removing a commit Command: svn merge -r [bad]:[bad-1] http://svn.example.com/repos/mytheme/trunk Example: [mytheme]$ svn merge -r 2495:2494 http://svn.example.com/repos/mytheme/trunk --- Reverse-merging r2495 into '.': U pdtheme-content.css U node.tpl.php [mytheme]$ svn status M pdtheme-content.css M node.tpl.php [mytheme]$ svn commit -m “Reverting r2495” Sending pdtheme-content.css Sending node.tpl.php Transmitting file data ... Committed revision 2520. [mytheme]$ Reapplying a commit Command: svn merge -r [commit-1]:[commit] http://svn.example.com/repos/mytheme/trunk Example: [mytheme]$ svn merge -r 2494:2495 http://svn.example.com/repos/mytheme/trunk --- Merging r2495 into '.': U pdtheme-content.css U node.tpl.php [mytheme]$ svn status M pdtheme-content.css M node.tpl.php [mytheme]$ svn commit -m “Reapplying r2495, which was reverted in r2520” Sending pdtheme-content.css Sending node.tpl.php Transmitting file data ... Committed revision 2532. [mytheme]$ [ 8 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • Creating a branch or tag Command: svn copy http://svn.example.com/repos/mytheme/trunk http://svn.example.com/repos/mytheme/branches/my_topic -m “message” Example: [mytheme]$ svn copy http://svn.example.com/repos/mytheme/trunk http://svn.example.com/repos/mytheme/branches/my_topic -m “Branching trunk” Committed revision 2533. [mytheme]$ For creating a tag, just replace “branches” with “tags”. Merging a topic branch into trunk Command: svn merge -r [split]:[current] http://svn.example.com/repos/mytheme/branches/my_topic Example: [mytheme]$ svn merge -r 2440:2495 http://svn.example.com/repos/mytheme/branches/my_topic U pdtheme-content.css U node.tpl.php [mytheme]$ svn status M pdtheme-content.css M node.tpl.php [mytheme]$ svn commit -m “Merging r2440:2495 from my_topic into trunk” Sending pdtheme-content.css Sending node.tpl.php Transmitting file data ... Committed revision 2596. [mytheme]$ Switching to a tag or branch Command: svn switch http://svn.example.com/repos/mytheme/branches/my_topic Example: [mytheme]$ svn switch http://svn.example.com/repos/mytheme/branches/my_topic G pdtheme-content.css U node.tpl.php U views-view-unformatted.tpl.php [mytheme]$ [ 9 of 10 ] Introduction to Using Subversion – Kathleen Murtagh
    • View commit history Command: svn log | less Example: [mytheme]$ svn log | less ------------------------------------------------------------------------ r2460 | kathleen | 2009-06-08 11:54:18 -0400 (Mon, 08 Jun 2009) | 1 line Adding documentation ------------------------------------------------------------------------ r2459 | kathleen | 2009-06-08 11:54:16 -0400 (Mon, 08 Jun 2009) | 1 line Made newsletter fixed width of 600px; ------------------------------------------------------------------------ r2457 | kathleen | 2009-06-08 11:54:12 -0400 (Mon, 08 Jun 2009) | 1 line [mytheme]$ View information about your working space Command: svn info Example: [mytheme]$ svn info Path: . URL: http://svn.example.com/repos/mytheme/trunk Repository Root: http://svn.example.com/repos/mytheme/ Repository UUID: 3b0d4cc6-56ef-4078-9f57-07815033268e Revision: 2491 Node Kind: directory Schedule: normal Last Changed Author: kathleen Last Changed Rev: 2460 Last Changed Date: 2009-06-08 11:54:18 -0400 (Mon, 08 Jun 2009) [mytheme]$ [ 10 of 10 ] Introduction to Using Subversion – Kathleen Murtagh