[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
subversion [2007/09/26 11:44]
zeman
subversion [2008/06/16 21:03]
zeman Corrected messed up formatting caused by migration from MediaWiki.
Line 3: Line 3:
 Subversion (''svn'') je nástroj pro archivaci (a v případě potřeby obnovu) starších verzí softwaru, který vyvíjíte. Pokud se vás v jednom projektu hrabe víc, Subversion vám pomůže ohlídat, abyste si vzájemně neničili práci. Subversion (''svn'') je nástroj pro archivaci (a v případě potřeby obnovu) starších verzí softwaru, který vyvíjíte. Pokud se vás v jednom projektu hrabe víc, Subversion vám pomůže ohlídat, abyste si vzájemně neničili práci.
  
-Pro projekty ÚFALu, na nichž chcete spolupracovat i s lidmi zvenkupoužijte vyhrazený stroj [[internal:svn.ms.mff.cuni.cz]].+Subversion vám poskytuje různé možnosti, kde založit tzv. **repozitář** (tedy archív verzí vašeho projektu), a různé možnosti, jak k němu přistupovat. **Lokální repozitář** vám stačí, používáte-li Subversion pro archivaci projektu, na kterém pracujete pouze vy, případně i další členové ÚFALu, ale všem vám stačí přistupovat k repozitáři z terminálu či skriptů běžících na linuxových počítačích na ÚFALu. Lokální repozitář je prostě podstrom adresářové struktury na síťových discích (konkrétně v ''/net/work/public/SVN'', ale můžete si ho vytvořit jinde). Když chcete lokálním repozitářem pracovatmusíte mít na dané místo souborový přístup. **Serverový repozitář** využijete, jestliže potřebujete s repozitářem pracovat z počítače, ze kterého není přímo vidět disk, na kterém je repozitář uložen (napřz Windows, z domova) nebo pokud s vámi na projektu spolupracují lidé vně ÚFALu, kteří ani úplný přístup do naší sítě nemajíU serverového repozitáře je potřeba nakonfigurovat metody, jakými se k němu bude po síti přistupovat, a také přístupová práva uživatelů.
  
-===== Nové Milanovo shrnutí (26.9.2007) =====+Pro projekty ÚFALu, na nichž chcete spolupracovat i s lidmi zvenku, (serverové repozitáře) použijte vyhrazený stroj [[internal:svn.ms.mff.cuni.cz]]. Návod na konfiguraci najdete níže v kapitole [[#Subversion Server]]. Návod na vytvoření jednoduchého lokálního repozitáře najdete níže v kapitole [[#Lokální Subversion]]. 
 + 
 +===== Subversion Server ===== 
 + 
 +Toto je Milanovo e-mailové shrnutí 26.9.2007. Týká se konfigurace serverových repozitářů na serveru svn.ms.mff.cuni.cz.
  
 Mili kolegove,  Mili kolegove, 
- po diskusi s Ondrou Bojarem a drobnem vylepseni naseho serveru svn jeste  + po diskusi s Ondrou Bojarem a drobnem vylepseni naseho serveru svn jeste jednou sepisuji co je potreba si projit a nastavit pri konfiguraci noveho projektu:
-jednou sepisuji co je potreba si projit a nastavit pri konfiguraci noveho  +
-projektu:+
  
-1) nalogujete se na svn.ufal.ms.mff.cuni.cz (= svn.ms.mff.cuni.cz) +  - nalogujete se na svn.ufal.ms.mff.cuni.cz (= svn.ms.mff.cuni.cz) (ucty byly preneseny z ufal.mff.cuni.cz
-    - ucty byly preneseny z ufal.mff.cuni.cz+  - pro vytvoreni projektu pouzijete skript (kteremu date jeste jmeno projektu):<code>/home/howto/create_new_project.sh <jmeno_projektu></code> 
 +  - pak se rozhodnete kterymi cestami budete s projektem pracovat - nejlepsi je asi nakonfigurovat vsechny (viz. nize) - tedy svn, webovy pristup do svn a Trac (take webovy). Vsude jsou prednastaveny nejake zakladni ucty, ale nejlepsi je tyto veci upravit podle vlastnich potreb. Napriklad nemusite chtit, aby ufal/maly... mel rw prava ve vasem projektu, jak tomu defaultne je!
  
-2) pro vytvoreni projektu pouzijete skript (kteremu date jeste jmeno  +==== Konfigurace webového rozhraní SVN (preferováno====
-projektu): /home/howto/create_new_project.sh <jmeno_projektu>+
  
-3) pak se rozhodnete kterymi cestami budete s projektem pracovat - nejlepsi je  +Toto rozhraní je užíváno SVN klientykteří dostanou repository udanou ve tvaru ''https://svn.ms.mff.cuni.cz/svn/PROJEKT''tjnapř.: 
-asi nakonfigurovat vsechny (viz. nize) - tedy svnwebovy pristup do svn a  +<code>    svn --username ufal checkout https://svn.ms.mff.cuni.cz/svn/$PROJEKT</code>
-Trac (take webovy)Vsude jsou prednastaveny nejake zakladni uctyale  +
-nejlepsi je tyto veci upravit podle vlastnich potrebNapriklad nemusite  +
-chtit, aby ufal/maly... mel rw prava ve vasem projektu, jak tomu defaultne  +
-je!+
  
----------------------------------------------------------------------------- +Co se tyce svn weboveho rozhrani, tak ten modul ma nasledujici konfiguraky (viz. /etc/httpd/conf.d/subversion.conf): 
-Co se tyce svn weboveho rozhrani, tak ten modul ma nasledujici konfiguraky  +  uzivatele: ''AuthUserFile /home/svn/users/passwords'' (Ondrej tomu laicky rika .htaccess) 
-(viz. /etc/httpd/conf.d/subversion.conf) : +  jejich opravneni: ''AuthzSVNAccessFile /home/svn/permissions/svnauthz.conf'' (zde se rika, zda RO nebo RW)
-                   uzivatele: AuthUserFile /home/svn/users/passwords +
-    (coz je to, cemu rikas .htaccess) +
-  +
-    jejich opravneni: AuthzSVNAccessFile /home/svn/permissions/svnauthz.conf +
-                   (zde se rika, zda RO nebo RW)+
 O zbytek se stara webovy modul subversion - ja mu jen rikam tohle. O zbytek se stara webovy modul subversion - ja mu jen rikam tohle.
  
-Jsou globalni.... +Konfiguraky jsou globalni, tj. pro vsechny projekty spolecne.
------------------------------------------------------------------------------ +
-Pak je tu svn protokol: +
-  pristupova prava se urcuji pro kazdy projekt nezavisle, v adresari conf v  +
-dane repository (jak je vytvorena mym skriptem)Vzory nastaveni pristupu  +
-jsou zde: /home/svn/repos/default/conf +
- (pozor - hesla se tu nastavuji jako textove retezce, neni to htaccess!) +
- (vytvoris si uzivatele a pridelis jim prava) +
------------------------------------------------------------------------------ +
-Stranou zustava Trac - pouziva take overovani vuci  +
-AuthUserFile /home/svn/users/passwords+
  
- Plus ma vlastni system pravTrac vas rozpozna podle loginu, se kterym jste  +O přidávání uživatelů a hesel viz níže.
-se prihlasili pri http autentizaci, ktera je pri pristupu vynucena. Pokud v  +
-danem projektu nejste zavedeni,i tak se k nemu dostanete s nejakymi default  +
-pravy. +
------------------------------------------------------------------------------ +
----------------------------------------------------------------------------- +
-Vastni uzivatele pro webove pristupy pridate do centralniho souboru webovych  +
-hesel v /home/svn/users/passwords (na coz prava mate) pomoci:+
  
-htpasswd -bs /home/svn/users/passwords <uzivatelske_jmeno> <heslo> +==== Konfigurace protokolu SVN ====
-----------------------------------------------------------------------------+
  
-  Doufamze timto shrnutim zajistime optimalni vyuziti  :+Toto rozhraní je užíváno SVN klientykteří dostanou repository udanou ve tvaru ''svn...'', tj. např.:
  
-  Milan+    svn --username ufal checkout svn://svn.ms.mff.cuni.cz/$PROJEKT
  
-===== Setting Up an Archive =====+Pristupova prava pro svn protokol se urcuji pro kazdy projekt nezavisle, v adresari conf v dane repository (jak je vytvorena mym skriptem), tj. napr.: 
 +    vim /home/svn/repos/$PROJEKT/conf/passwd  # vytvořit uživatele 
 +    vim /home/svn/repos/$PROJEKT/conf/authz   # nastavit jim práva 
 + 
 + 
 +Vzory nastaveni pristupu jsou zde: ''/home/svn/repos/default/conf'' 
 + 
 +Pozor - hesla se tu nastavuji jako textove retezce, neni to htaccess! Po siti tedy tecou nekryptovane! 
 + 
 +==== Konfigurace přístupu k systému Trac ==== 
 + 
 +Trac - pouziva take overovani vuci: 
 +    AuthUserFile /home/svn/users/passwords 
 + 
 +Trac ma navic vlastni system prav. Trac vas rozpozna podle loginu, se kterym jste se prihlasili pri http autentizaci, ktera je pri pristupu vynucena. Pokud v danem projektu nejste zavedeni, tak se k nemu dostanete s nejakymi default pravy. 
 + 
 +Takto spustíte konfigurační skript pro Trac vašeho projektu: 
 +    trac-admin /home/trac/$PROJEKT 
 + 
 + 
 +==== Přidávání vlastních uživatelů pro webové přístupy (SVN i Trac) ==== 
 + 
 +Vlastni uzivatele pro webove pristupy pridate do centralniho souboru webovych hesel v ''/home/svn/users/passwords'' (na coz prava mate) pomoci: 
 + 
 +    htpasswd -bs /home/svn/users/passwords <uzivatelske_jmeno> <heslo> 
 +nebo 
 +    htpasswd -s /home/svn/users/passwords <uzivatelske_jmeno> 
 +    # na heslo budete dotázáni, heslo se nezobrazí ani na terminálu 
 + 
 +===== Lokální Subversion ===== 
 + 
 +//(Z návodu ve wiki University of Maryland převzal a upravil Dan Zeman.)// 
 + 
 +Tento návod se týká lokálních repozitářů SVN, tedy takových, ke kterým budete přistupovat pouze z linuxových počítačů v síti ÚFALu.
  
 You can use svn to keep track of your own code. You can use svn to keep track of your own code.
Line 70: Line 78:
 <code>svnadmin create /net/work/public/SVN/$MY_PROJECT</code> where obviously ''$MY_PROJECT'' should be replaced by the desired name for your project. <code>svnadmin create /net/work/public/SVN/$MY_PROJECT</code> where obviously ''$MY_PROJECT'' should be replaced by the desired name for your project.
  
-**Beware!** Do not use older versions (e.g. 1.1.4) of Subversion to create a repository! By default, they will use the Berkeley DB backend, which is not recommended. You may be able to "successfully" finish the repository creation but things are likely to get broken later! Check your version by running ''svn --version''Version 1.3.1 and above should work fine.+**Beware!** Do not use older versions (e.g. 1.1.4) of Subversion to create a repository! By default, they will use the Berkeley DB backend, which is not recommended. You may be able to "successfully" finish the repository creation but things are likely to get broken later! Check your version by running <code>svn --version</code> Version 1.3.1 and above should work fine.
  
 Let's say you want to archive the directory ''/home/$USER/proj'' and all its subdirectories. The following code puts your project in the ''proj'' folder under version control. After executing the commands, your ''proj'' folder will become a working copy of the files stored in the repository. Let's say you want to archive the directory ''/home/$USER/proj'' and all its subdirectories. The following code puts your project in the ''proj'' folder under version control. After executing the commands, your ''proj'' folder will become a working copy of the files stored in the repository.
Line 345: Line 353:
  
 This command takes the differences between the alopez branch from rev. 250 to 271, and applies them to the working copy.  Note that this may create conflicts!  (To preview these, I can use the ''--dry-run'' flag to ''svn merge'').  Once I've successfully resolved any conflicts, merged the files, and run regression tests as described above, I can commit the files to the development trunk. This command takes the differences between the alopez branch from rev. 250 to 271, and applies them to the working copy.  Note that this may create conflicts!  (To preview these, I can use the ''--dry-run'' flag to ''svn merge'').  Once I've successfully resolved any conflicts, merged the files, and run regression tests as described above, I can commit the files to the development trunk.
 +
  
 ===== Tags ===== ===== Tags =====
Line 365: Line 374:
 </code> </code>
  
-=== [[VersionControlTags|Current Tags and Branches]] === +===== Rolling Back Versions =====
- +
-=== Rolling Back Versions ===+
  
 What do you do if something is broken that wasn't broken before?  You can simply check out a copy of the file (or the entire project) from a point before the problem arose.  In order to see the revisions in which a particular file changed, you can run What do you do if something is broken that wasn't broken before?  You can simply check out a copy of the file (or the entire project) from a point before the problem arose.  In order to see the revisions in which a particular file changed, you can run
Line 381: Line 388:
 ''svn update &lt;file&gt; -r &lt;revision&gt;'' ''svn update &lt;file&gt; -r &lt;revision&gt;''
  
-=== Setting Up an Archive ===+===== Setting Up an Archive =====
  
 You can use svn to keep track of your own code.  Let's say you want to archive the directory ''/nfshomes/$USER/proj'' and all its subdirectories.  You can do so with the following commands. You can use svn to keep track of your own code.  Let's say you want to archive the directory ''/nfshomes/$USER/proj'' and all its subdirectories.  You can do so with the following commands.
Line 406: Line 413:
 See [[VersionControlSetup|VersionControlSetup]] for the series of commands used to set up the MTEval archive. See [[VersionControlSetup|VersionControlSetup]] for the series of commands used to set up the MTEval archive.
  
-=== Stupid Repository Tricks ===+===== Stupid Repository Tricks =====
  
 You can accomplish virtually anything you can imagine with the repository, although it may not be immediately obvious how.  For instance: You can accomplish virtually anything you can imagine with the repository, although it may not be immediately obvious how.  For instance:
  
-: $ Get the latest revision number of your current branch (wine cluster only).: ''svn info -r HEAD''  +  * Get the latest revision number of your current branch: ''svn info -r HEAD''You can also try ''svn log | head -2'' 
-:You can also try ''svn log | head -2'' +  View the logs of all changes to your current branch since you last updated: ''svn log -r HEAD:BASE'' 
- +  View all the differences between your working copy and the latest revision of your current branch: ''svn diff -r HEAD .'' 
-: $ View the logs of all changes to your current branch since you last updated.: ''svn log -r HEAD:BASE'' +  Merge into your current working copy the bug fixes checked in to r475 of the bittorrent branch (even if that's not your working branch): ''svn merge -r 474:475 file:///fs/clip-mteval/svn/Programs/branches/bittorrent .'' 
- +  Change your mind when you realize those bug fixes did more harm than good: ''svn merge -r 475:474 file:///fs/clip-mteval/svn/Programs/branches/bittorrent .''
-: $ View all the differences between your working copy and the latest revision of your current branch.: ''svn diff -r HEAD .'' +
- +
-: $ Merge into your current working copy the bug fixes checked in to r475 of the bittorrent branch (even if that's not your working branch).: ''svn merge -r 474:475 file:///fs/clip-mteval/svn/Programs/branches/bittorrent .'' +
- +
-: $ Change your mind when you realize those bug fixes did more harm than good.: ''svn merge -r 475:474 file:///fs/clip-mteval/svn/Programs/branches/bittorrent .'' +
- +
  
-=== Troubleshooting ===+===== Troubleshooting =====
  
 If you get the message: If you get the message:
Line 440: Line 440:
 * pray * pray
  
-=== Further Reading ===+===== Further Reading =====
  
 All of the information in this tutorial comes directly from the online [http://svnbook.red-bean.com/ Subversion book].  It is not necessary to read the entire book to get a good idea of how subversion works.  In general, if you only have a limited period of time in which to get acquainted, you will get the most mileage out of the following parts of the book: All of the information in this tutorial comes directly from the online [http://svnbook.red-bean.com/ Subversion book].  It is not necessary to read the entire book to get a good idea of how subversion works.  In general, if you only have a limited period of time in which to get acquainted, you will get the most mileage out of the following parts of the book:
Line 452: Line 452:
 Most likely, this is all you will need to look at to do most of your work.  Most of this material comes from Section 3.5. Most likely, this is all you will need to look at to do most of your work.  Most of this material comes from Section 3.5.
  
-[[Category:Resources]] 

[ Back to the navigation ] [ Back to the content ]