TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
Advertisement
Associates
Associates
techtuts Darkmindz
CSS Tutorials Tutorialsphere.com - Free Online Tutorials
Boston PHP SurfnLearn
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-08-2008, 01:18 PM   #1 (permalink)
The Frequenter
Advanced Programmer Top Contributor Good Samaritan 
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 469
Thanks: 26
sketchMedia is on a distinguished road
Default basic SVN Guide

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
Code:
svn co --help
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
__________________

Last edited by sketchMedia : 09-08-2008 at 07:12 PM.
sketchMedia is offline  
Reply With Quote
Old 09-17-2008, 01:36 AM   #2 (permalink)
The Gregarious
Upcoming Programmer Inquisitive 
 
Join Date: Sep 2007
Posts: 684
Thanks: 85
Tanax is on a distinguished road
Default

Exactly, what does this do?

I mean.. I know what it DOES, but what's the use of it?
Nicely written!
__________________
Tanax is offline  
Reply With Quote
Old 09-17-2008, 10:07 AM   #3 (permalink)
The Frequenter
Advanced Programmer Top Contributor Good Samaritan 
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 469
Thanks: 26
sketchMedia is on a distinguished road
Default

SVN is a version control system or VCS.

SVN or any VCS like CVS etc help control files and the changes to them, it basically allows you to track them over time. Each file is given a 'revision' number and every time a change is made to that file the revision number increments thus allowing you to do all sorts of things.

For example:
I make a change to the code held within the repository and lets say, I made a right hash of it; well with a vcs its easy to just revert back to a previous revision number (in svn i believe its called a reverse merge).

A better, more indepth guide to the concepts of version controlling:
A Visual Guide to Version Control | BetterExplained
__________________
sketchMedia is offline  
Reply With Quote
Old 09-21-2008, 10:34 PM   #4 (permalink)
The Gregarious
Upcoming Programmer Inquisitive 
 
Join Date: Sep 2007
Posts: 684
Thanks: 85
Tanax is on a distinguished road
Default

Ah I see!
Thanks a bunch :)
__________________
Tanax is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:02 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0