Getting Started/Sources/Subversion (ro)

From KDE TechBase


Getting Started/Sources/Using Subversion with KDE


Ghid de folosire a utilitarului Subversion
Tutorial Series   Getting Started
Previous   None
What's Next   n/a
Further Reading   n/a

Introducere

Aceasta este o scurta introducere in folosirea utilitarului Subversion pentru a accesa fisierele din depozitul SVN al KDE. Daca aveti nevoie de un manual complet al utilitarului Subversion, va recomandam "Version Control with Subversion".

Primii pasi

Pentru a accesa depozitul SVN al KDE aveti nevoie de doua lucruri:

  1. Un program client Subversion
  2. Un cont de utilizator al depozitului SVN

Nota: Daca doar doriti sa descarcati fisiere, fara a avea nevoie de drepturi de scriere, nu aveti nevoie de cont de utilizator; folositi "svn" ca si "<protocol>", fara "<utilizator>@", si serverul "anonsvn.kde.org" in loc de "svn.kde.org".

Instalarea clientului Subversion: aceasta pagina nu contine instructiuni privind instalarea clientului Subversion. Pentru a afla cum puteti instala Subversion consultati documentatia de instalare a programelor pentru sistemul de operare pe care il folositi. Veti avea nevoie de cel putin versiunea 1.1 a Subversion. Daca compilati Subversion din codul sursa si doriti sa accesati depozitul SVN al KDE cu protocolul Internet "https" (si nu svn+ssh), aveti nevoie de suport pentru SSL si ZLIB, deci va trebui sa folositi optiunile de compilare --with-ssl --with-zlib.

De asemenea puteti instala una dintre multele interfete grafice disponibile pentru Subversion. Acest tutorial a fost scris pentru a-i ajuta pe cei care folosesc doar clientul svn si se refera la actiunile care pot fi realizate cu cunoscutul utilitar cvs.

Obtinerea unui cont de utilizator: daca ati avut un cont de acces la depozitul CVS, acesta a fost adaptat pentru folosirea cu Subversion. Daca nu ati avut un asemenea cont, consultati acest ghid pentru a afla cum puteti obtine unul.

Note
Daca nu va mai amintiti parola contului CVS, exista doua modalitati simple de a o recupera: folositi cvspwd (C) sau cvs-unscramble (Perl).


Structura depozitului SVN a KDE

svn.kde.org/home/kde

Aceasta este adresa depozitului SVN a KDE. Poate fi accesata folosind oricare dintre protocoalele Internet HTTPS sau SVN+SSH, ceea ce inseamna ca parola dumneavoastra nu va putea fi interceptata de catre persoane nedorite.

Semnatura SSL in format MD5 recunoscuta de catre depozitul SVN este:

F6BF EDE2 D016 D1B2   4F18 742E 2C8F B7EF

iar semnatura SSL in format SHA1 este:

e1:e6:41:96:3c:eb:ae:78:e2:73:0d:a2:32:2f:6b:21:13:bf:3d:0f

Daca folositi protocolul svn+ssh, semnatura cheii RSA a serverului este:

86:f3:66:06:20:74:81:d0:1b:b4:2f:25:03:f7:8e:fb

Depozitul este impartit in urmatoarele cataloage principale:

  1. /branches
  2. /tags
  3. /trunk

Interfata depozitului o veti gasi la adresa http://websvn.kde.org/


Catalogul principal /trunk

In catalogul principal /trunk veti gasi ultima versiune a surselor KDE. Acestea vor deveni urmatoarea distributie a KDE si a aplicatiilor sale. Tot aici veti gasi si modulul www, care contine paginile sitului principal KDE si ale siturilor afiliate.

/trunk este impartit mai departe in:

  • KDE/
    Versiunea de dezvoltare a KDE (ceea ce va deveni urmatoarea distributie publica). contine urmatoarele module:
    • kdelibs - Librariile KDE esentiale, folosite de catre toate aplicatiile KDE
    • kdebase - Aplicatii KDE esentiale, cum ar fi Centrul de Control KDE, panoul Kicker si navigatorul Konqueror
    • kdeaccessibility - Librariile KDE pentru accesibilitate
    • kdeadmin - Aplicatii de administrare a KDE
    • kdeartwork - Imagini, teme desktop, sunete si alte fisiere multimedia
    • kdebindings - Interfete pentru limbaje de programare altele decat C++
    • kdeedu - Aplicatii educationale
    • kdegames - Jocuri
    • kdegraphics - Aplicatii pentru grafica
    • kdemultimedia - Aplicatii pentru multimedia
    • kdenetwork - Aplicatii pentru retea
    • kdepim - Aplicatii pentru Gestionarea Informatilor Personale
    • kdepimlibs - Librarii folosite de aplicatiile pentru Gestionarea Informatilor Personale
    • kdesdk - SDK pentru KDE
    • kdetoys - Aplicatii de amuzament (nu se incadreaza in categoria jocurilor)
    • kdeutils - Aplicatii de uz general
    • kdevelop - Mediul integrat de dezvoltare a aplicatiilor KDevelop
    • kdevplatform - Platforma de baza a KDevelop
    • kdewebdev - Utilitare KDE pentru dezvoltarea aplicatiilor Web
  • kde-common
Common admin/ directory
  • bugs/
Fisierele Bugzilla
  • developer.kde.org/
Paginile sitului developer.kde.org
  • extragear/
Aplicatii KDE in afara distributiei principale.
  • kdereview/
Locatia temporara a aplicatiilor KDE care sunt considerate a avea calitatea necesara pentru distributie. De aici, odata ce problemele principale au fost rezolvate, aceste aplicatii vor fi mutate fie in /trunk/KDE/ sau in /trunk/extragear/
  • kdesupport/
Aplicatii si librarii auxiliare
  • koffice/
    Grupul de aplicatii pentru birou al KDE, continand:
    • karbon
    • kchart
    • kexi
    • kformula
    • kivio
    • koshell
    • kplato
    • kpresenter
    • krita
    • kspread
    • kugar
    • kword
  • konstruct/
Konstruct, aplicatie de compilare automata
  • l10n-kde3/
Traduceri pentru modulele KDE 3 marcate "unstable" (extragear, playground)
  • l10n-kde4/
Traduceri pentru KDE 4
  • playground/
Applicatii aflate in dezvoltare, dar care nu au calitatea necesara pentru a fi distribuite publicului larg.
  • qt-copy/
Copia librariei Qt de la Trolltech, librarie care sta la baza KDE.
  • tests/
teste pentru khtml, KOffice si ksvg
  • valgrind/
Aplicatia Valgrind, gazduita in depozitul KDE, dar care nu face parte din KDE. Ultimele versiuni ale aplicatiei Valgrind le puteti gasi in propriul lor depozit. Modulele Valgrind aflate in depozitul KDE ajung doar pana la versiunea 2.4.
  • www/
Paginile sitului principal KDE si ale siturilor afiliate. Drepturile de scriere in acest catalog sunt limitate.

Catalogul principal /tags

Acest catalog contine distributiile oficiale ale programelor dezvoltate in depozitul KDE. Fiecare aplicatie are aici un subcatalog continand versiunile numerotate.

Spre exemplu, codul sursa al KDE 3.4.0 se afla in /tags/KDE/3.4.0/.

Catalogul principal /branches

Acest catalog contine versiunile alternative create dupa fiecare distributie majora.

Most KDE applications adhere to the philosphy that new features (as well as new user-visible strings) are added only to the next release cycle — the one that lives in /trunk/. However, bugfixes are applied to all applications, even after release.

In order to do that, a branch is created at the moment of the release, indicating the state of the files at that time. Bugfixes are then checked in to those files. Those branches are the ones in /branches/.

For instance, the KDE 3.4.x branch can be found under /branches/KDE/3.4/

The subdirectories you will find inside /branches are the application subdirs, like akregator/, amarok/, arts/, k3b/, etc. You will also find a KDE/ subdir, containing the official KDE releases since time immemorial.

One special subdir is found in /branches: work/. This subdir contains the so-called "work branches", that is, branches containing features being worked on, sometimes highly experimental. Multi-application work branches always are checked in to /branches/work/, but single-application branches may be found in each application's subdir. That is a decision left to the developers.


Checking out and updating

Checking out

In order to check out something with Subversion, you use the checkout subcommand.

WARNING: If you checkout trunk/KDE/ or branches/KDE/foo/ you will download complete kde-i18n!

Suppose you wanted to check out only KDevelop from the KDE repository. You would do:

CVS command:

cvs -d :pserver:[email protected]:/home/kde login
cvs -d :pserver:[email protected]:/home/kde checkout kdevelop

Subversion command:

CVS users currently using ssh access, should use protocol svn+ssh, CVS users currently using password access, should use protocol https in the following.

svn checkout <protocol>://<username>@svn.kde.org/home/kde/trunk/KDE/kdevelop

Updating

In order to update, you use the update subcommand.

This is no different from CVS: you change into your checked out copy (for those new to this whole process, the checked out copy should be in your Home folder) and issue a svn update (or, shorter, svn up) command.

Knowing the status of a file

To know which local files you had modified, in CVS most people did

cvs up

and looked at the files with M, this does not work with svn so you have to do

svn status

to know the status of the files.

Committing to the repository

Just like in CVS, committing to the Subversion repository is accomplished with the commit or checkin (ci for short) subcommands.

CVS command:

cvs commit
# or
cvs ci
# or
cvs ci filename.cpp

Subversion command:

svn commit
# or
svn ci
# or
svn ci filename.cpp

This way, svn will launch the editor specified in $SVN_EDITOR for you to compose the commit message. If you prefer, you can give svn the -m option with your full message:

svn ci -m "Updating protocol to conform to HTTP/1.1"

Ignoring files

Subversion stores ignored files per directory. To edit the ignored files of the directory you are currently in, do

 svn propedit svn:ignore .

that will launch your editor, write there the names of the files you want to ignore, one file per line. Once you are done, do a commit so the ignored list file gets updated on the server.

A lot of files were ignored in CVS with help from global ignore list which is not supported yet by SVN. You can wait for svn 1.3 or you need to add the ignore list to the [miscellany] group in your ~/.subversion/config (all in one line):

global-ignores = *.o *.lo *.la .*.rej *.rej .*~ *~ .#* #*# .DS_Store *.moc
*.moc.cc *.moc.cpp config.log config.status config.cache *.gmo .deps .libs
SunWS_cache *.lo *.la *.rpo *.la.closure *_la_closure.cpp *_la_closure.cc
*_la_closure.cxx *.all_cc.cc *.all_cpp.cpp *.all_C.C *.all_cxx.cxx
*_meta_unload.cc *_meta_unload.h *_meta_unload.cpp *_meta_unload.C
*_meta_unload.cxx index.cache.bz2 .memdump Makefile.rules.in Makefile.calls.in
Makefile.rules Makefile.calls autom4te.cache *.kidl

Working with multiple revisions and branches

Unlike CVS, Subversion doesn't generate a revision number for each file modified. Instead, the full repository is versioned, as a whole. This way, a given revision number represents the state the repository was on a given date. In other words, a revision number is like a timestamp (in fact, the Subversion server uses this fact to search for dates in the repository faster).

So, for instance, when you check out the KDE repository, Subversion will tell you the following:

Updated to revision 403821.

This means that the latest revision available at the time of the operation was 403821. If you make a modification and commit, Subversion will update the server-side revision and will inform you of it. Like CVS, only the committed files will be updated: you will need run cvs up to update the rest of the files.

If you want to retrieve a specific revision of a file, you can use the -r switch. Besides the revision number itself, -r accepts a number of other possibilities:

  • The revision number: for example, use -r 403819 to retrieve that version
  • BASE: the revision you updated to
  • COMMITTED: the revision a file was last modified, before BASE
  • PREV: the revision of the previous commit to the file before COMMITTED
  • HEAD: the most recent revision available in the server
  • { date }: between curly brackets, you can specify a date for searching the closest revisions

The following illustrates the evolution of the keywords:

  1. You run svn up to update to the latest available revision. Suppose Subversion tells you it updated to revision 403821. This means that HEAD and BASE are 403821.
  2. You modify file README and commit it. Suppose Subversion tells you it committed revision 403822. This means HEAD, BASE and COMMITTED are 403822.
  3. You modify the file again and commit it. Now PREV is 403822, but HEAD, BASE and COMMITTED are updated to a new value (suppose it's 403823).
  4. Now someone else modifies the repository, and you update your working copy. If Subversion tells you it updated to 403824, this means now HEAD and BASE are moved to 403824 (but PREV and COMMITTED stay the same)
  5. If someone modifies the README file now, HEAD is moved. The other keywords stay the same for you, until you update. At this time, we will have HEAD = 403825 (the latest available revision), BASE = 403824 (the revision you last updated to), COMMITTED = 403823 (the revision of the latest change to the file when you last updated) and PREV = 403822 (the revision of the change before COMMITTED)

Those keywords are useful to retrieve logs and diffs for commits to the repository.

If you want to see the difference between your working copy and BASE, you can run:

svn diff

This is a very fast operation, since Subversion keeps a local copy of BASE. It doesn't need a network connection to accomplish this operation.

If you want to see the difference between your local copy and the latest available on the server, you will run:

svn diff -r HEAD

If you want to see what has changed in the repository since you've last updated, you can use:

svn diff -r BASE:HEAD

If you want to see the last change to a file before BASE, you can use:

svn diff -r PREV:BASE
# or
svn diff -r PREV:COMMITTED

That is also valid for the svn log command.

Linking in subdirectories from other places

It can happen you would like to include a copy of a subdirectory from another place, but just for convenience, not for developing the code in there. Of course it should be updated automatically whenever the original changes. Subversion can help you. You need to edit the property svn:external of the directory the subdirectory should be added to. So for the current directory you use

svn propedit svn:externals .

and then enter lines of the form

libkhalkhi svn://anonsvn.kde.org/home/kde/trunk/playground/pim/khalkhi

Updating will now fetch /trunk/playground/pim/khalkhi into the subdirectoy libkhalkhi.

Warning
Beware that you cannot commit changes you did to the local copy of the external subdirectory, it is just a readonly copy.


You use svn://anonsvn.kde.org and not another protocol, because anonsvn.kde.org is accessible to everyone. Using https: or svn+ssh: would only work for users of that protocol. There are still some small disadvantage with anonsvn.kde.org: It is not always in synchronization with svn.kde.org, so updates in the original branch may take a while to appear on anonsvn.kde.org. And some strict firewalls are blocking the svn: protocol.

A special case in KDE 3 is the subdirectory admin, containing the KDE 3 build utilities. It is linked in to the top directory in all modules, and maintained in /branches/KDE/3.5/kde-common. For admin the KDE subversion server is configured to allow readonly access for everyone, so if you see

admin https://svn.kde.org/home/kde/branches/KDE/3.5/kde-common/admin

there is no need to change this.

More information on the kde wiki

See the KDE wiki for more information about subversion in KDE