View source for subversion

{{anchor href="top"}}
Hits :  **{{hits}}**

== subversion :: a very simple tutorial ==

{{ToC from="h2" to="h3"}}

=== SubVersion ===

http://subversion.tigris.org

A version control system that is a compelling replacement for CVS in the open source community.

http://svnbook.red-bean.com/

((#top))
-----------

=== Installation ===

Παραθέτω την εγκατάσταση από την πηγαίο κώδικα.
Η σειρά είναι απαραίτητη.

%%(bash)
wget -c http://apache.otenet.gr/dist/apr/apr-1.3.3.tar.bz2
tar jxvf apr-1.3.3.tar.bz2
cd apr-1.3.3
./configure
make
make install
%%

%%(bash)
wget -c http://apache.otenet.gr/dist/apr/apr-util-1.3.4.tar.bz2
tar jxvf apr-util-1.3.4.tar.bz2
cd apr-util-1.3.4
./configure --with-apr=/usr/local/apr/ --with-berkeley-db=/opt/berkeleydb
make
make install
%%

%%(bash)
wget -c http://www.webdav.org/neon/neon-0.28.3.tar.gz
tar zxvf neon-0.28.3.tar.gz
cd neon-0.28.3
./configure --with-ssl=gnutls
make
make install
%%

%%(bash)
wget -c http://subversion.tigris.org/downloads/subversion-1.5.5.tar.bz2
tar jxvf subversion-1.5.5.tar.bz2
cd subversion-1.5.5
./configure --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr/ --with-berkeley-db=/opt/berkeleydb --with-ssl
make
make install
%%

__//**ΣΗΜΕΙΩΣΗ:**//__ Το svn ΔΕΝ μπορεί να κατεβάσει μέσω ssl εάν ΔΕΝ έχει εγκατασταθεί το neon με ssl υποστήριξη. Το **with-ssl**
κατά το configuration δηλώνει ακριβώς αυτό το πράγμα. Εάν το neon είναι εγκατεστημένο με ssl τότε ενεργοποίησέ το.

((#top))
-----------

=== Attention - Apache ===

%%(code)
locate httpd.conf
vim +/dav_svn_module /usr/local/apache2/conf/httpd.conf
%%

Comment:
%%(code)
# LoadModule dav_svn_module     modules/mod_dav_svn.so
# LoadModule authz_svn_module   modules/mod_authz_svn.so
%%

((#top))
-----------

=== Example ===

%%(code)
> svn co https://wackofork.svn.sourceforge.net/svnroot/wackofork/trunk/wacko wacko
> cd wacko
> svn up
> svn status
> cd lang
> svn commit wakka.el.php -m "More greek translation" --username emanelhs
%%

((#top))
-----------

=== Create SVN Repository ===

Για να περάσουμε κάποιο project που έχουμε σε svn repository, χρειάζεται αρχικά να δημιουργήσουμε το repository αυτό.
Η δομή παράγεται αυτόματα, έστω λοιπόν ότι είναι η διαδρομή : /opt/svn_repos/

%%(code)
> svnadmin create /opt/svn_repos/
> ls -la !$
ls -la /opt/svn_repos/
total 36
drwxr-xr-x  7 ebal ebal 4096 2007-11-28 17:02 .
drwxr-xr-x 17 root root 4096 2007-11-28 16:58 ..
drwxr-xr-x  2 ebal ebal 4096 2007-11-28 17:02 conf
drwxr-xr-x  2 ebal ebal 4096 2007-11-28 17:02 dav
drwxr-sr-x  5 ebal ebal 4096 2007-11-28 17:02 db
-r--r--r--  1 ebal ebal    2 2007-11-28 17:02 format
drwxr-xr-x  2 ebal ebal 4096 2007-11-28 17:02 hooks
drwxr-xr-x  2 ebal ebal 4096 2007-11-28 17:02 locks
-rw-r--r--  1 ebal ebal  229 2007-11-28 17:02 README.txt
%%

((#top))
-----------

=== Import Project ===

Για να περάσουμε ένα νέο project στο svn repository χρειάζεται να κάνουμε import τα αρχεία.
Η εντολή είναι : **svn import source destination options** και ένα τυπικό παράδειγμα είναι το παρακάτω:

%%(code)
> svn import /usr/local/apache2/htdocs/MyPhpWebCalendar file:///opt/svn_repos/MyPhpWebCalendar -m "Inital Import"
Adding         /usr/local/apache2/htdocs/MyPhpWebCalendar/lang
Adding         /usr/local/apache2/htdocs/MyPhpWebCalendar/lang/english.php
Adding         /usr/local/apache2/htdocs/MyPhpWebCalendar/lang/greek.php
Adding         /usr/local/apache2/htdocs/MyPhpWebCalendar/calendar-config.php
Adding         /usr/local/apache2/htdocs/MyPhpWebCalendar/footer.php
Adding         /usr/local/apache2/htdocs/MyPhpWebCalendar/index.php
Adding         /usr/local/apache2/htdocs/MyPhpWebCalendar/header.php

Committed revision 1.
%%

Για να ελέγξουμε ότι όλα είναι οκ απλά τρέχουμε την εντολή:

%%(code)
> svn list file:///opt/svn_repos/MyPhpWebCalendar
calendar-config.php
footer.php
header.php
index.php
lang/
%%

((#top))
-----------

=== First Initial Copy ===

Και για να κατεβάσουμε το πρώτο μας αντίγραφο πρέπει να κάνουμε checkout:

%%(code)
> cd /tmp

> svn checkout file:///opt/svn_repos/MyPhpWebCalendar
A    MyPhpWebCalendar/lang
A    MyPhpWebCalendar/lang/english.php
A    MyPhpWebCalendar/lang/greek.php
A    MyPhpWebCalendar/calendar-config.php
A    MyPhpWebCalendar/footer.php
A    MyPhpWebCalendar/index.php
A    MyPhpWebCalendar/header.php
Checked out revision 1.
%%

Εάν δούμε όλα τα αρχεία που δημιουργήθηκαν με :
%%(code)
> ls -a
%%

Θα παρατηρήσουμε ότι δημιουργήθηκε και ένας κρυφός κατάλογος **.svn**

Εδώ να επισημάνω ότι είνα το ίδιο ακριβώς τα :

svn checkout
svn co

((#top))
-----------

=== help ===

http://svnbook.red-bean.com/en/1.4/svn.tour.cycle.html

%%(code)
> svn help

   add
   blame (praise, annotate, ann)
   cat
   checkout (co)
   cleanup
   commit (ci)
   copy (cp)
   delete (del, remove, rm)
   diff (di)
   export
   help (?, h)
   import
   info
   list (ls)
   lock
   log
   merge
   mkdir
   move (mv, rename, ren)
   propdel (pdel, pd)
   propedit (pedit, pe)
   propget (pget, pg)
   proplist (plist, pl)
   propset (pset, ps)
   resolved
   revert
   status (stat, st)
   switch (sw)
   unlock
   update (up)
%%

((#top))
-----------

=== Revert ===

Μία από τις πιο σημαντικές ενέργειες όταν εργαζόμαστε σε εάν revision σύστημα είναι το revert.
Με αυτή την δυνατότητα μπορούμε να "γυρίσουμε" πίσω σε παλαιότερη έκδοση ώστε να διορθώσουμε 
ή να ελεγξουμε κάτι στο πρόγραμμά μας.

%%(code)
$ svn info
...
Revision: 27234
...

$ svn update -r 27170

$ svn info
...
Revision: 27170
...
%%

((#top))
-----------

=== svnsync ===

((http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.reposadmin.maint.tk.svnsync svnsync)) aka **svn mirroring**

%%(html)
rm -rf wackowiki*
svnadmin create wackowiki

cat > $PWD/wackowiki/hooks/pre-revprop-change << EOF
#!/bin/bash
exit 0
EOF

chmod u+x $PWD/wackowiki/hooks/pre-revprop-change

svnsync init file://$PWD/wackowiki https://wackowiki.svn.sourceforge.net/svnroot/wackowiki 

svnsync sync file://$PWD/wackowiki
%%