SVN - Simple Guide (linux and windows command line)
Note: For the examples I have used an imaginary SVN repo (reository) called: ----http://test.talkphp.com-----. On this repo i have imported 2 TalkPHP scripts:
- TalkPHP_Login
- TalkPHP_Gravatar
in order to give some meaning to the examples.
Also '$' denotes the linux command line, i dont know any GUI's so someone else will have to write about them, the commands here are identical to SVN on the windows command line (you will need to download the Binarys from the SVN site)
The general structure is (basic, im not going into trunk tags and branches):
Code:
-TalkPHP_Login/
-TalkPHP_Login/
-levels/
-levels_super_administrator.php
-levels_administrator.php
-levels_moderator.php
-levels_user.php
-access.php
-accounts.xml
-include.php
-.htaccess
-index.php
-gpl.txt
-TalkPHP_Gravatar/
-index.php
-TalkPHP_Gravatar.php
checkout:
Code:
svn (co | checkout) http://test.talkphp.com/folderstructuretocheckout nameofdirtocreate --username xxxxx --password xxxxx [-N -r -q]
N.B.For more information about the extra options type
You can either use
checkout or the shorthand
co, you may also need to specify a username and pass, you can specify these by typing --username and --password otherwise it will use the username you are currently using on your computer, in my case 'sam' which is incorrect for the repo's username 'sketchmedia'
Code:
$svn co http://repo/dir --username sketchmedia --password xxxxxxx
example:
I want to checkout the TalkPHP_Login folder from the repo and I want to save it in a folder called 'testdir' (this is optional, if not specified it will create a dir based on the folder name being checkout) on my local machine, here is the SVN command to do so (with the results below, the lines beginning with 'A' are results, basically it means Added to the local DIR):
Code:
$svn co http://svn.assembla.com/svn/talkphp/TalkPHP_Login testdir
A test2dir/TalkPHP_Login/gpl.txt
A test2dir/TalkPHP_Login/TalkPHP_Login
A test2dir/TalkPHP_Login/TalkPHP_Login/include.php
A test2dir/TalkPHP_Login/TalkPHP_Login/levels
A test2dir/TalkPHP_Login/TalkPHP_Login/levels/levels_administrator.php
A test2dir/TalkPHP_Login/TalkPHP_Login/levels/levels_moderator.php
A test2dir/TalkPHP_Login/TalkPHP_Login/levels/levels_super_administrator.php
A test2dir/TalkPHP_Login/TalkPHP_Login/levels/levels_user.php
A test2dir/TalkPHP_Login/TalkPHP_Login/.htaccess
A test2dir/TalkPHP_Login/TalkPHP_Login/access.class.php
A test2dir/TalkPHP_Login/TalkPHP_Login/accounts.xml
A test2dir/TalkPHP_Login/index.php
Checked out revision 25.
If no dir name specified:
Code:
$svn co http://test.talkphp.com/TalkPHP_Login
A TalkPHP_Login/gpl.txt
A TalkPHP_Login/TalkPHP_Login
A TalkPHP_Login/TalkPHP_Login/include.php
A TalkPHP_Login/TalkPHP_Login/levels
A TalkPHP_Login/TalkPHP_Login/levels/levels_administrator.php
A TalkPHP_Login/TalkPHP_Login/levels/levels_moderator.php
A TalkPHP_Login/TalkPHP_Login/levels/levels_super_administrator.php
A TalkPHP_Login/TalkPHP_Login/levels/levels_user.php
A TalkPHP_Login/TalkPHP_Login/.htaccess
A TalkPHP_Login/TalkPHP_Login/access.class.php
A TalkPHP_Login/TalkPHP_Login/accounts.xml
A TalkPHP_Login/index.php
We can also checkout 2 different directories (and repos i think) from SVN
Code:
$ svn co http://test.talkphp.com/TalkPHP_Login http://test.talkphp.com/TalkPHP_Gravatar
A TalkPHP_Login/gpl.txt
A TalkPHP_Login/TalkPHP_Login
A TalkPHP_Login/TalkPHP_Login/include.php
A TalkPHP_Login/TalkPHP_Login/levels
A TalkPHP_Login/TalkPHP_Login/levels/levels_administrator.php
A TalkPHP_Login/TalkPHP_Login/levels/levels_moderator.php
A TalkPHP_Login/TalkPHP_Login/levels/levels_super_administrator.php
A TalkPHP_Login/TalkPHP_Login/levels/levels_user.php
A TalkPHP_Login/TalkPHP_Login/.htaccess
A TalkPHP_Login/TalkPHP_Login/access.class.php
A TalkPHP_Login/TalkPHP_Login/accounts.xml
A TalkPHP_Login/index.php
Checked out revision <revision number>.
A TalkPHP_Gravatar/TalkPHP_Gravatar.php
A TalkPHP_Gravatar/index.php
Checked out revision <revision number>.
As you can see it checked out both folders from the repo.
Checkout acts recursively, in other words will recursively download everything from that root dir (the one you specify) as you can see from the above examples. To stop this behavior you can use the -N arg:
Code:
svn co http://svn.assembla.com/svn/talkphp/TalkPHP_Login -N
A TalkPHP_Login/gpl.txt
A TalkPHP_Login/index.php
Checked out revision 25.
Here you can see it only checked out the contains of the root and did not recursively download the rest.
You can also specify a revision to download, a revision is a snapshot of the code from the past (or future), for this you use the '-r' flag then the revision number, in our previous example it stated 'checkout revision 25' which is the current revision or 'HEAD' in SVN speak. I will use the -r flag to retrieve revision 24:
Code:
$svn co http://svn.assembla.com/svn/talkphp/TalkPHP_Login -r 24 -N
A TalkPHP_Login/gpl.txt
A TalkPHP_Login/index.php
Checked out revision 24.
That's about it for a rough guide checkout, any questions just ask.
I'll finish the other parts and post them later.
Next Part: Update and Conflicts