sukaeto@aliyah:->pwd /home/sukaeto/svndemo sukaeto@aliyah:->mkdir demo2 sukaeto@aliyah:->cd demo2/ //Having the directories branches, tags & trunk is svn convention. Trunk is //where the majority of development is done. A specific revision can be copied //to tags and given a name, so that it can be checked out again at any time //regardless of what's happened since it was tagged (e.g. a tag called //'version-1.0') Branches are generally used to test experimental features //before being merged back into trunk. sukaeto@aliyah:->mkdir branches tags trunk sukaeto@aliyah:->cd .. //An initial import. An editor window will open asking for a comment which will //be added to the log for this commit. Setting the $EDITOR environment variable //controls which editor will be run. sukaeto@aliyah:->svn import demo2/ https://shuebox.nss.udel.edu/cisc275/shared/demo2 Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) Adding demo2/trunk Adding demo2/branches Adding demo2/tags Committed revision 7. sukaeto@aliyah:->rm -rf demo2/ //To check out a working copy from the repository. The first path is the //repository you wish to check out. The second is where it will create the //working copy. sukaeto@aliyah:->svn co https://shuebox.nss.udel.edu/cisc275/shared/demo2/trunk ./demo2 Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) Checked out revision 7. sukaeto@aliyah:->cd demo2/ sukaeto@aliyah:->touch main.java sukaeto@aliyah:->vi main.java sukaeto@aliyah:->cat main.java public class main { public static void main(String[] args) { System.out.println("Bluh"); } } //To track a file, use svn add. The file will be tracked in the repository //henceforth. To *stop* tracking a file, use svn rm - but be careful! This //will delete the file from your working copy as well! sukaeto@aliyah:->svn add main.java A main.java //Making a commit to the repository. Again, an editor instance will start as //with the import. Also again, $EDITOR controlls which editor is started. sukaeto@aliyah:->svn ci Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) Adding main.java Transmitting file data . Committed revision 8. sukaeto@aliyah:->cat main.java public class main { public static void main(String[] args) { System.out.println("Bluh"); } } sukaeto@aliyah:->vi main.java //OH NOES!!!11ONE Looks like someone totally messed up this file! sukaeto@aliyah:->cat main.java public class main { public static void main(String[] args) { System.out.println("Bluh"); } adfasdfhpwaoehfsa fhasd asasasdfsdfomgtotallymessingthisupadfsadfsadfsdf dddasdfasdf } //Use svn revert to get rid of unwanted changes. You can revert files one at //a time, or you can revert an entire directory, like I did below. sukaeto@aliyah:->svn revert ./* Reverted 'main.java' //Alright, we're back to a good state. sukaeto@aliyah:->cat main.java public class main { public static void main(String[] args) { System.out.println("Bluh"); } } sukaeto@aliyah:->vi main.java sukaeto@aliyah:->touch somenewfilewereallywanttotrack.java sukaeto@aliyah:->vi somenewfilewereallywanttotrack.java //Whenever you create new files, make sure you remember to add them! When you //add new files and make them necessary in preexisting ones, but forget to add //the new files to the repository you are breaking the build. This is very bad! //When you check in your changes, the new files won't go with, and when the next //programmer checks out the code, (s)he won't be able to compile it! sukaeto@aliyah:->svn add somenewfilewereallywanttotrack.java A somenewfilewereallywanttotrack.java //svn diff will tell us (without any extra parameters) what has changed between //our working copy and the last checked-in revision. You can also check the //difference between differing revisions by passing in revision numbers as //arguments sukaeto@aliyah:->svn diff Index: main.java =================================================================== --- main.java (revision 8) +++ main.java (working copy) @@ -1,5 +1,5 @@ public class main { public static void main(String[] args) { - System.out.println("Bluh"); + System.out.println("Bluh more!"); } } Index: somenewfilewereallywanttotrack.java =================================================================== --- somenewfilewereallywanttotrack.java (revision 0) +++ somenewfilewereallywanttotrack.java (revision 0) @@ -0,0 +1 @@ +There's totally some useful stuff in here. sukaeto@aliyah:->svn ci Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) Sending main.java Adding somenewfilewereallywanttotrack.java Transmitting file data .. Committed revision 9. //svn blame tells you, for each line in a file, who wrote that line and on what //revision it first appeared. I suppose you can use this to blame colleagues //for introducing bugs. Also, more constructively, You can use it to give //someone credit for *fixing* bugs. sukaeto@aliyah:->svn blame main.java Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) 8 jkeffer public class main { 8 jkeffer public static void main(String[] args) { 9 jkeffer System.out.println("Bluh more!"); 8 jkeffer } 8 jkeffer } //svn update can be used to pull down changes from the repository which were //made by others since the last time you communicated with the repository (via //a commit, a checkout, etc.) In this case, we're already at the lastest //revision. svn update only updates our local log so . . . sukaeto@aliyah:->svn update Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) At revision 9. //. . . we can run svn log and get a history of what changes were made. When //you want to refer to a specific revision (for a diff, an update, a checkout, //etc,) you'll use it's revision number. Here we have revision 7, 8 and 9. //Newer revisions will always have a higher number than older ones. sukaeto@aliyah:->svn log Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString) ------------------------------------------------------------------------ r9 | jkeffer | 2011-02-27 18:17:37 -0500 (Sun, 27 Feb 2011) | 2 lines Added some stuff that we totally needed. ------------------------------------------------------------------------ r8 | jkeffer | 2011-02-27 18:05:05 -0500 (Sun, 27 Feb 2011) | 2 lines Added a simple main ------------------------------------------------------------------------ r7 | jkeffer | 2011-02-27 18:03:02 -0500 (Sun, 27 Feb 2011) | 2 lines Initial Import ------------------------------------------------------------------------ //Use svn info to get some general information on your working copy sukaeto@aliyah:->svn info Path: . URL: https://shuebox.nss.udel.edu/cisc275/shared/demo2/trunk Repository Root: https://shuebox.nss.udel.edu/cisc275/shared Repository UUID: 4d2620e6-e475-cf27-b4ee-b39e2de82ed9 Revision: 9 Node Kind: directory Schedule: normal Last Changed Author: jkeffer Last Changed Rev: 9 Last Changed Date: 2011-02-27 18:17:37 -0500 (Sun, 27 Feb 2011) sukaeto@aliyah:->touch anewfile //svn status will list the status of files in the working copy. Tracked files //which haven't been changed since the last checkin/checkout won't be displayed. //Files wich have been added will be prefaced by an 'A'. Modified ones with a //'M'. And as you can see here, untracked ones with a '?' (useful to make sure //you're not breaking the build!) sukaeto@aliyah:->svn status ? anewfile //Of course, svn help will give you a list of all svn commands. svn help // will give you help on (so svn help co will give you info //specific to checkout.) You can also check out the SVN book for free online: //http://svnbook.red-bean.com/ for more information. Or you can have a look at //the slides Charlie Greenbacker generously made available on his website: //http://www.cis.udel.edu/~charlieg/labs/Lab5_SVN_Intro.pdf and //http://www.cis.udel.edu/~charlieg/labs/Lab7_SVN_More_F10.pdf sukaeto@aliyah:->svn help usage: svn [options] [args] Subversion command-line client, version 1.6.11. Type 'svn help ' for help on a specific subcommand. Type 'svn --version' to see the program version and RA modules or 'svn --version --quiet' to see just the version number. Most subcommands take file and/or directory arguments, recursing on the directories. If no arguments are supplied to such a command, it recurses on the current directory (inclusive) by default. Available subcommands: add blame (praise, annotate, ann) cat changelist (cl) checkout (co) cleanup commit (ci) copy (cp) delete (del, remove, rm) diff (di) export help (?, h) import info list (ls) lock log merge mergeinfo mkdir move (mv, rename, ren) propdel (pdel, pd) propedit (pedit, pe) propget (pget, pg) proplist (plist, pl) propset (pset, ps) resolve resolved revert status (stat, st) switch (sw) unlock update (up) Subversion is a tool for version control. For additional information, see http://subversion.tigris.org/