SVN klijent za CentOS 6U6

Čemu SVN klijent služi – za povezivanje na neki VCS server i na njemu podignut repozitorijum sa dokumentima, i izmenu sadržaja na njemu.
A čemu sve to? U pitanju je sistem za kontrolisanje verzije dokumenata (VCS – version control system) :
Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data or examine the history of how your data changed. A software/document versioning and revision control system distributed under an open source license.
Objašnjenje za SVN : link.
Dobar tutorial.

Neke definicije :
Repository : A repository is the heart of any version control system. It is the central place where developers store all their work. Repository not only stores files but also the history. Repository is accessed over a network, acting as a server and version control tool acting as a client. Clients can connect to the repository, and then they can store/retrieve their changes to/from repository. By storing changes, a client makes these changes available to other people and by retrieving changes, a client takes other people’s changes as a working copy.
Trunk: The trunk is a directory where all the main development happens and is usually checked out by developers to work on the project.
Tags : The tags directory is used to store named snapshots of the project. Tag operation allows to give descriptive and memorable names to specific version in the repository.
Branches: Branch operation is used to create another line of development. It is useful when you want your development process to fork off into two different directions. For example, when you release version 5.0, you might want to create a branch so that development of 6.0 features can be kept separate from 5.0 bug-fixes.
Working copy : Working copy is a snapshot of the repository. The repository is shared by all the teams, but people do not modify it directly. Instead each developer checks out the working copy. The working copy is a private workplace where developers can do their work remaining isolated from the rest of the team.
Commit changes : Commit is a process of storing changes from private workplace to central server. After commit, changes are made available to all the team. Other developers can retrieve these changes by updating their working copy.

E pa pošto bi trebalo da održavam takav sadržaj, treba da na moju mašinu nabacim SVN klijenta (subversion client). Ovo dole je za GUI klijent.
Stranica sa poređenjem klijenata (i za WIN i za Linux) : link.
Poređenje SVN klijenata za Linux : link.
Poređenjem sam došla do SmartSVN-a 😉 naravno free verziju.

GUI klijent
Instalacija za SVN :
* Neophodan početni uslov : Java Runtime Environment
Evo kako se proverava jeli ga imate (obavezno to uraditi kroz nalog kroz koji ćete kasnije SVN i koristiti, kod mene je to “velda”) :
$ java -version
java version “1.7.0_85”
OpenJDK Runtime Environment (rhel-2.6.1.3.el6_7-x86_64 u85-b01)
OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode)
* Spustiti ga sa neta (spušta se kao tar.gz)
* # tar xvfz smartsvn-linux-9_0_0.tar.gz
* Otići u folder gde je razvijen tar.gz, i startovati skriptu :
$ cd /home/velda/Desktop/Linux_stvari/SVN/smartsvn/bin
$./smartsvn.sh &
Pri podizanju će tražiti podatke o proxy serveru.
Kada se pokaže prozor sa opcijama, izabrati stavku “Run”.
Pošto je u mom slučaju repozitorijum sa dokumentima već podignut, ne treba mi taj deo priče.

CLI (command line interface) SVN klijent
Ovde su komande univerzalne, bez obzira da li je u pitanju WIN ili Linux mašina.
SVN CLI klijent bi trebalo da je u principu na OS-u, ali ako ga nema, samo uraditi :
# yum install svn*

Struktura podataka na serveru (i u lokalu, kada se podaci povuku)
Everything is defined in the file system and no database is used.
folder services – Contains services defined in a Powershell script files. Each service must be in its own file. Misli se na fajlove koji predstavljaju pojedinačne dokumente.
folder templates – Contains templates used to render services in various formats. Šeme koje određuju koji se deo fajlova pod services vidi u kom slučaju (kod nas su to pdf i html, jer izlaze želimo u tim formatima). output\[catalog]\[format] – Contains rendered documents for given catalog and output format.
folder tools – Place for 3thd party tools.
folder functions – Contains Powershell functions that can be used while defining services and templates.
fajl build.ps1 – Build script.
fajl config.ps1 – Configuration script in which certain aspects are defined for all services.

Korišćenje CLI SVN klijenta
Napomena : SVE komande se rade iz foldera u koji se u lokalu spuštaju fajlovi (u mom slučaju /home/velda/SVN).
Dobar link1 i još jedan link2.
Napomena : u principu uvek koristiti apsolutne putanje!
*Izlistati šta se sve nalazi u repozitorijumu (komanda “list”) :
# svn –username ‘moj.ad.nalog’ –password ‘moja.ad.lozinka’ list http://svn.moj.domen/svn/portfolio/branches/next
_docs/
build.ps1
config.ps1
functions/
services/
templates/
tools/
Pošto repozitorijumu prilazim sa mojim AD kredencijalima, najzgodnije je da ih odmah ubacim u komandu…..
*Kopirati rad iz repositorijuma kod sebe na mašinu. To se radi komandom “checkout”, ili skraćeno “co”. Na mojoj mašini sam za to rezervisala lokaciju /home/velda/SVN :
# svn –username ‘moj.ad.nalog’ –password ‘moja.ad.lozinka’ checkout http://svn.moj.domen/svn/portfolio/branches/next /home/velda/SVN
U grani “next” je razvojna verzija, a u grani “trunk” je produkcija (uobičajni raspored, ali ne i obavezan!).
Podaci se moraju čekirati iz repozitorijuma, da bi se, posle izmena, mogli commit-ovati!
Checkout ne radi na nivou pojedinačnih fajlova.
*Pre nego što se počne rad, svaki put uraditi “update” da bi se pokupile izmene koje su možda drugi članovi projekta uradili.
* Provera urađenih izmena (izmene se rade sa običnim editorom) :
# svn status
? root
M services/neki.tamo.projekat.ps1
Ovo daje samo to koji je fajl izmenjen, ali ne i detalje izmene. A ovo daje i detalje :
# svn diff
Index: services/tamo.neki.projekat.ps1
===================================================================
— services/tamo.neki.projekat.ps1 (revision 138)
+++ services/tamo.neki.projekat.ps1 (working copy)
@@ -28,6 +28,7 @@
“Definisanje repozitorijuma za !source code! i asocijacija revizija koda sa problemima”
“!REST! interfejs za integraciju sa drugim delovima infrastrukture”
“!Cross-browser, cross-database! sa dostupnim klijentima za Android !OS!”
+ “Velda testiranje”
)
Docs = @{
*Poništavanje izmene
# svn revert services/tamo.neki.projekat.ps1
U pitanju je relativna putanja do izmenjenog fajla, koju dobijamo iz komande #svn status
* Kako videti sve izmene (tj logove svih izmena) :
# svn –username ‘moj.ad.user’ –password ‘moj.ad.pass’ log
Ovo daje sve logove za sve projekte
…..
Ako hoćemo logove za samo jedan od projekata :
# svn –username ‘moj.ad.user’ –password ‘moj.ad.pass’ log services/Projekat1.ps1