[ 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

Next revision
Previous revision
Next revision Both sides next revision
subversion [2007/02/22 15:57]
zeman
subversion [2007/10/03 23:55]
zeman Typo.
Line 2: Line 2:
  
 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 zvenku, použijte vyhrazený stroj [[internal:svn.ms.mff.cuni.cz]].
 +
 +
 +===== Nové Milanovo shrnutí (26.9.2007) =====
 +
 +Mili kolegove, 
 + 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:
 +
 +  - nalogujete se na svn.ufal.ms.mff.cuni.cz (= svn.ms.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!
 +
 +
 +
 +
 +
 +
 +==== Konfigurace webového rozhraní SVN (preferováno) ====
 +
 +Toto rozhraní je užíváno SVN klienty, kteří dostanou repository udanou ve tvaru ''https://svn.ms.mff.cuni.cz/svn/PROJEKT'', tj. např.:
 +<code>    svn --username ufal checkout https://svn.ms.mff.cuni.cz/svn/$PROJEKT</code>
 +
 +Co se tyce svn weboveho rozhrani, tak ten modul ma nasledujici konfiguraky (viz. /etc/httpd/conf.d/subversion.conf):
 +  * uzivatele: ''AuthUserFile /home/svn/users/passwords'' (Ondrej tomu laicky rika .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.
 +
 +Konfiguraky jsou globalni, tj. pro vsechny projekty spolecne.
 +
 +O přidávání uživatelů a hesel viz níže.
 +
 +
 +
 +==== Konfigurace protokolu SVN ====
 +
 +Toto rozhraní je užíváno SVN klienty, kteří dostanou repository udanou ve tvaru ''svn...'', tj. např.:
 +
 +    svn --username ufal checkout svn://svn.ms.mff.cuni.cz/$PROJEKT
 +
 +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
 +
 +-----------------------------------------------------------------------------------------------------------
 +
 +Doufam, ze timto shrnutim zajistime optimalni vyuziti  :) 
 +
 +  Milan
 +
  
 ===== Setting Up an Archive ===== ===== Setting Up an Archive =====
Line 10: Line 85:
 <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 88: Line 163:
 svn update svn update
 </code> </code>
 +
 +
 +
 +===== Ignoring unversioned files in svn status =====
 +
 +Imagine that your makefile creates a ''tmp'' file or directory. You do not want to version this file, because it can be any time recreated by calling ''make''. And you do not want to see the file listed in ''svn status'' output. Then you need to edit the ''svn:ignore'' property of the folder containing ''tmp''.
 +
 +  - Go to the folder containing ''tmp''.
 +  - Call ''svn propedit svn:ignore .''.
 +  - Enter files to be ignored, one per line. But you can use wildcards, as in ''*.d''. Note that some files are ignored by default (e.g. ''*.o'').
 +  - Call ''svn status''. Now you should not see the files you said should be ignored, but for now you will see the folder containing them. That's because this folder's property (''svn:ignore'') has changed.
 +  - You need to call ''svn commit'' to make the property stored in the repository and available to other users.
 +
 +Note that you just set property of one folder, not of a whole subtree of folders. That is, ''tmp'' files in subfolders will not be ignored until you set the same property in the subfolders. In general, properties can be set recursively but it is not trivial with multi-line property values, which is the case of ''svn:ignore''.
  
  
Line 346: Line 435:
  
 : $ 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 .'' : $ 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 .''
- 
-=== Ignoring unversioned files in ''svn status'' === 
- 
-Imagine that your makefile creates a ''tmp'' file or directory. You do not want to version this file, because it can be any time recreated by calling ''make''. And you do not want to see the file listed in ''svn status'' output. Then you need to edit the ''svn:ignore'' property of the folder containing ''tmp''. 
- 
-# Go to the folder containing ''tmp''. 
-# Call ''svn propedit svn:ignore .''. 
-# Enter files to be ignored, one per line. But you can use wildcards, as in ''*.d''. Note that some files are ignored by default (e.g. ''*.o''). 
-# Call ''svn status''. Now you should not see the files you said should be ignored, but for now you will see the folder containing them. That's because this folder's property (''svn:ignore'') has changed. 
-# You need to call ''svn commit'' to make the property stored in the repository and available to other users. 
- 
-Note that you just set property of one folder, not of a whole subtree of folders. That is, ''tmp'' files in subfolders will not be ignored until you set the same property in the subfolders. In general, properties can be set recursively but it is not trivial with multi-line property values, which is the case of ''svn:ignore''. 
  
  

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