Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
subversion [2007/05/15 16:10] zeman Ignoring unversioned files in svn status. |
subversion [2009/02/19 15:17] zeman Drobná oprava práce se složkami. |
||
---|---|---|---|
Line 3: | Line 3: | ||
Subversion ('' | Subversion ('' | ||
- | ===== Setting Up an Archive | + | 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 ''/ |
+ | |||
+ | Pro projekty ÚFALu, na nichž chcete spolupracovat i s lidmi zvenku, (serverové repozitáře) použijte vyhrazený stroj [[internal: | ||
+ | |||
+ | ===== Subversion Server | ||
+ | |||
+ | Toto je Milanovo e-mailové shrnutí z 26.9.2007. Týká se konfigurace serverových repozitářů na serveru svn.ms.mff.cuni.cz. | ||
+ | |||
+ | 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):< | ||
+ | - 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/ | ||
+ | |||
+ | ==== Konfigurace webového rozhraní SVN (preferováno) ==== | ||
+ | |||
+ | Toto rozhraní je užíváno SVN klienty, kteří dostanou repository udanou ve tvaru '' | ||
+ | < | ||
+ | |||
+ | Co se tyce svn weboveho rozhrani, tak ten modul ma nasledujici konfiguraky (viz. / | ||
+ | * uzivatele: '' | ||
+ | * jejich opravneni: '' | ||
+ | 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. | ||
+ | |||
+ | |||
+ | === 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 ''/ | ||
+ | |||
+ | htpasswd -bs / | ||
+ | nebo | ||
+ | htpasswd -s / | ||
+ | # na heslo budete dotázáni, heslo se nezobrazí ani na terminálu | ||
+ | |||
+ | ==== Konfigurace protokolu SVN (raději nepoužívat, | ||
+ | |||
+ | Toto rozhraní je užíváno SVN klienty, kteří dostanou repository udanou ve tvaru '' | ||
+ | |||
+ | svn --username ufal checkout svn:// | ||
+ | |||
+ | 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 / | ||
+ | vim / | ||
+ | |||
+ | Vzory nastaveni pristupu jsou zde: ''/ | ||
+ | |||
+ | Pozor - hesla se tu nastavuji jako textove retezce, neni to htaccess! Po siti tedy tecou nekryptovane! | ||
+ | |||
+ | |||
+ | |||
+ | ==== Konfigurace přístupu k systému Trac ==== | ||
+ | |||
+ | Trac poskytuje webové rozhraní k repozitáři a dalším službám kolem správy projektu. Používá tutéž evidenci uživatelů a hesel jako webový ('' | ||
+ | |||
+ | AuthUserFile / | ||
+ | |||
+ | Při přístupu k webovému rozhraní Trac vyžaduje http autentizaci (zde tedy zadáte jméno a heslo, které máte zavedené v souboru ''/ | ||
+ | |||
+ | Takto spustíte konfigurační skript pro Trac vašeho projektu: | ||
+ | trac-admin / | ||
+ | |||
+ | Chcete-li mít přístup k nastavení Tracu pro tento projekt i přes webové rozhraní Tracu, uvnitř '' | ||
+ | |||
+ | < | ||
+ | |||
+ | Ve webovém rozhraní (https:// | ||
+ | |||
+ | === Časté problémy === | ||
+ | |||
+ | == V tracu chybí tlačítko Browse Source == | ||
+ | |||
+ | Ověřte, že v souboru ''/ | ||
+ | |||
+ | == V prohlížení kódu se neukazuje Unicode == | ||
+ | |||
+ | Ověřte, že v souboru ''/ | ||
+ | |||
+ | ===== 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 10: | Line 96: | ||
< | < | ||
- | **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 " | + | **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 " |
Let's say you want to archive the directory ''/ | Let's say you want to archive the directory ''/ | ||
Line 30: | Line 116: | ||
rm -rf proj.old | rm -rf proj.old | ||
</ | </ | ||
+ | |||
+ | Výše uvedený postup je možné po úpravách použít i pro vzdálený repozitář na serveru SVN. Předpokládáme, | ||
+ | |||
+ | < | ||
+ | mv $PROJ $PROJ.old | ||
+ | mkdir tmp | ||
+ | cd tmp | ||
+ | mkdir $PROJ | ||
+ | cp -r / | ||
+ | mkdir $PROJ/ | ||
+ | mkdir $PROJ/tags | ||
+ | svn --username $USER import $PROJ https:/// | ||
+ | cd .. | ||
+ | svn checkout -q https:/// | ||
+ | rm -rf tmp | ||
+ | rm -rf $PROJ.old</ | ||
+ | |||
+ | Pokud jste si jisti, že pro tento projekt nebudete nikdy potřebovat větve ani otagované verze, můžete pravděpodobně vynechat vytváření podsložek '' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Přechod z lokálního repozitáře na serverový ===== | ||
+ | |||
+ | Nepamatujete si, kde vlastně leží repozitář vašeho projektu? Nacházíte-li se ve své pracovní kopii projektu, příkazem '' | ||
+ | |||
+ | < | ||
+ | Path: . | ||
+ | URL: file:/// | ||
+ | Repository Root: file:/// | ||
+ | Repository UUID: 9edd2012-306b-417f-90a6-873db92f1308 | ||
+ | Revision: 7 | ||
+ | Node Kind: directory | ||
+ | Schedule: normal | ||
+ | Last Changed Author: zeman | ||
+ | Last Changed Rev: 7 | ||
+ | Last Changed Date: 2009-02-19 10:58:20 +0100 (Thu, 19 Feb 2009)</ | ||
+ | |||
+ | Vzhledem k tomu, že URL ve výše uvedeném hlášení začíná < | ||
+ | |||
+ | < | ||
+ | / | ||
+ | cd / | ||
+ | # Přístup k svn přes protokol svn (nešifrovaně!) | ||
+ | vi authz | ||
+ | vi passwd | ||
+ | # Přístup k svn a tracu přes protokol https | ||
+ | vi / | ||
+ | # Pokud jsem se tam ještě nenašel, můžu své heslo nastavit takto: | ||
+ | htpasswd -s / | ||
+ | # Přístupová práva k svn repozitáři prostřednictvím https (obecně i specificky pro tento projekt) | ||
+ | vi / | ||
+ | # Přístupová práva ke správě projektu v tracu | ||
+ | # Mělo by jít též editovat ve webovém rozhraní | ||
+ | trac-admin / | ||
+ | |||
+ | Serverový projekt a repozitář jsou založené a přístupová práva doufejme správně nastavena. Teď se tedy můžeme pustit do vlastního přenosu dat projektu. Samozřejmě předpokládáme, | ||
+ | |||
+ | < | ||
+ | scp interset.svndump svn.ms.mff.cuni.cz:/ | ||
+ | rm interset.svndump | ||
+ | ssh svn.ms.mff.cuni.cz | ||
+ | svnadmin load / | ||
+ | rm interset.svndump | ||
+ | # Log off svn server, continue on local machine | ||
+ | exit | ||
+ | # Replace the working copy of local project by a working copy of the server project | ||
+ | cd .. | ||
+ | mv interset interset.localwc | ||
+ | svn --username zeman checkout https:// | ||
+ | mv trunk interset | ||
+ | cd interset</ | ||
===== Přechod z CVS pod SVN ===== | ===== Přechod z CVS pod SVN ===== | ||
Line 285: | Line 447: | ||
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! | 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! | ||
+ | |||
===== Tags ===== | ===== Tags ===== | ||
Line 305: | Line 468: | ||
</ | </ | ||
- | === [[VersionControlTags|Current Tags and Branches]] === | ||
- | === Rolling Back Versions === | + | |
+ | |||
+ | |||
+ | |||
+ | ===== Rolling Back Versions | ||
What do you do if something is broken that wasn't broken before? | What do you do if something is broken that wasn't broken before? | ||
- | '' | + | '' |
This will show you the change log. Hopefully, this will be sufficiently informative as to when particular changes occurred, but if you aren't sure what happened in a particular revision, you can always run | This will show you the change log. Hopefully, this will be sufficiently informative as to when particular changes occurred, but if you aren't sure what happened in a particular revision, you can always run | ||
- | '' | + | '' |
To see the changes that have been made. Once you figure out which version you need, you can restore your working copy to that revision using | To see the changes that have been made. Once you figure out which version you need, you can restore your working copy to that revision using | ||
- | '' | + | '' |
- | === Setting Up an Archive === | + | Warning: If you update the whole project ('' |
+ | |||
+ | The following chapters from the SVN book have some answers: | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | |||
+ | The following code should undo the changes between the revisions 302 and 303 (note the minus sign before 303, meaning negative change) while keeping the other changes between 303 and HEAD. | ||
+ | |||
+ | < | ||
+ | # alternatively: | ||
+ | svn status | ||
+ | svn diff | ||
+ | svn commit -m " | ||
+ | |||
+ | ===== Setting Up an Archive | ||
You can use svn to keep track of your own code. Let's say you want to archive the directory ''/ | You can use svn to keep track of your own code. Let's say you want to archive the directory ''/ | ||
Line 346: | Line 527: | ||
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 | + | * Get the latest revision number of your current branch: '' |
- | :You can also try '' | + | * View the logs of all changes to your current branch since you last updated: '' |
+ | * View all the differences between your working copy and the latest revision of your current branch: '' | ||
+ | * 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): ''< | ||
+ | * Change your mind when you realize those bug fixes did more harm than good: ''< | ||
- | : $ View the logs of all changes to your current branch since you last updated.: '' | + | ===== Troubleshooting |
- | + | ||
- | : $ View all the differences between your working copy and the latest revision of your current branch.: '' | + | |
- | + | ||
- | : $ 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).: '' | + | |
- | + | ||
- | : $ Change your mind when you realize those bug fixes did more harm than good.: '' | + | |
- | + | ||
- | + | ||
- | + | ||
- | === Troubleshooting === | + | |
If you get the message: | If you get the message: | ||
Line 380: | Line 555: | ||
* pray | * pray | ||
- | === Further Reading === | ||
- | All of the information in this tutorial comes directly from the online [http:// | ||
- | * [http:// | + | ===== Further Reading ===== |
- | * [http:// | + | |
- | * [http:// | + | All of the information in this tutorial comes directly from the online [[http:// |
- | * [http:// | + | |
- | * [http:// | + | |
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
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: |