[ 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/10/08 12:21]
zeman Přeuspořádání.
subversion [2009/02/19 12:50]
zeman Založení serverového repozitáře.
Line 32: Line 32:
 O přidávání uživatelů a hesel viz níže. O přidávání uživatelů a hesel viz níže.
  
-==== Konfigurace protokolu SVN ====+ 
 +==== Konfigurace protokolu SVN (raději nepoužívat, nekryptovaný přenos) ====
  
 Toto rozhraní je užíváno SVN klienty, kteří dostanou repository udanou ve tvaru ''svn...'', tj. např.: Toto rozhraní je užíváno SVN klienty, kteří dostanou repository udanou ve tvaru ''svn...'', tj. např.:
Line 46: Line 47:
  
 Pozor - hesla se tu nastavuji jako textove retezce, neni to htaccess! Po siti tedy tecou nekryptovane! Pozor - hesla se tu nastavuji jako textove retezce, neni to htaccess! Po siti tedy tecou nekryptovane!
 +
  
 ==== Konfigurace přístupu k systému Trac ==== ==== Konfigurace přístupu k systému Trac ====
Line 57: Line 59:
     trac-admin /home/trac/$PROJEKT     trac-admin /home/trac/$PROJEKT
  
 +=== Časté problémy ===
 +
 +== V tracu chybí tlačítko Browse Source ==
 +
 +Ověřte, že v souboru ''/home/trac/PROJEKT/conf/trac.ini'' máte nastavenu proměnnou ''repository_dir'' na ''/home/svn/repos/PROJEKT''.
 +
 +== V prohlížení kódu se neukazuje Unicode ==
 +
 +Ověřte, že v souboru ''/home/trac/PROJEKT/conf/trac.ini'' máte nastavenu proměnnou ''default_charset'' na ''utf-8''. **Default je chybný, iso-8859-15.**
  
 ==== Přidávání vlastních uživatelů pro webové přístupy (SVN i Trac) ==== ==== Přidávání vlastních uživatelů pro webové přístupy (SVN i Trac) ====
Line 66: Line 77:
     htpasswd -s /home/svn/users/passwords <uzivatelske_jmeno>     htpasswd -s /home/svn/users/passwords <uzivatelske_jmeno>
     # na heslo budete dotázáni, heslo se nezobrazí ani na terminálu     # na heslo budete dotázáni, heslo se nezobrazí ani na terminálu
 +
  
 ===== Lokální Subversion ===== ===== Lokální Subversion =====
Line 98: Line 110:
 rm -rf proj.old rm -rf proj.old
 </code> </code>
 +
 +Výše uvedený postup je možné po úpravách použít i pro vzdálený repozitář na serveru SVN. Předpokládáme, že jste si už vytvořili repozitář ''$REP'' podle návodu uvedeného dříve, a že jste k&nbsp;němu nakonfigurovali přístupová práva. Řádek ''svnadmin create ...'' zde tedy vynecháváme.
 +
 +<code>cd /home/$USER
 +mv $PROJ $PROJ.old
 +mkdir tmp
 +cd tmp
 +mkdir $PROJ
 +cp -r /home/$USER/$PROJ.old $PROJ/trunk
 +mkdir $PROJ/branches
 +mkdir $PROJ/tags
 +svn --username $USER import $PROJ https:///svn.ms.mff.cuni.cz/svn/$REP/$PROJ --message 'Initial import'
 +cd ..
 +svn checkout -q https:///svn.ms.mff.cuni.cz/svn/$REP/$PROJ/trunk $PROJ
 +rm -rf tmp
 +rm -rf $PROJ.old</code>
 +
 +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 ''branches'' a ''tags'' a celý projekt posunout o patro výš. To jsem ale nezkoušel.
 +
 +
 +
 +===== 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 ''svn info'' to zjistíte:
 +
 +<code>10:58 zen:/export/home/zeman/projekty/interset> svn info
 +Path: .
 +URL: file:///net/work/public/SVN/interset/trunk
 +Repository Root: file:///net/work/public/SVN/interset
 +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)</code>
 +
 +Vzhledem k tomu, že URL ve výše uvedeném hlášení začíná <nowiki>"file://",</nowiki> jde o lokální repozitář. Nyní je tedy potřeba založit prázdný serverový repozitář podle postupu uvedeného výše.
 +
 +<code>ssh svn.ms.mff.cuni.cz
 +/home/howto/create_new_project.sh interset
 +cd /home/svn/repos/interset/conf
 +vi authz
 +vi passwd</code>
  
 ===== Přechod z CVS pod SVN ===== ===== Přechod z CVS pod SVN =====
Line 353: Line 409:
  
 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 373: Line 430:
 </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
  
-''svn log &lt;file&gt;''+''svn log $FILE''
  
 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
  
-''svn diff &lt;file&gt; -r &lt;revision&gt;''+''svn diff $FILE -r $REVISION''
  
 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 
  
-''svn update &lt;file&gt; -r &lt;revision&gt;''+''svn update $FILE -r $REVISION''
  
-=== Setting Up an Archive ===+Warning: If you update the whole project (''svn update .'' in the root of the working copy) this way, svn will behave as if the revisions after the one you rolled back to did not exist. For instance, it will not show you the renewed files as changed when you call ''svn status''. If you call ''svn log'', it will show only revisions up to the one you rolled back to. If you call ''svn commit'' without making additional changes, nothing will happen. However, ''svn diff -r HEAD:BASE'' **will** show the differences between your current (rolled-back) version and the most recent one in the repository. So how do we force svn to store the restored old revision as the newest one in the repository? 
 + 
 +The following chapters from the SVN book have some answers: 
 +  * http://svnbook.red-bean.com/nightly/en/svn.tour.history.html#svn.tour.history.snapshots 
 +  * http://svnbook.red-bean.com/nightly/en/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.resurrect 
 +  * http://svnbook.red-bean.com/nightly/en/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo 
 + 
 +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. 
 + 
 +<code>svn merge -c -303 https://svn.ms.mff.cuni.cz/svn/$REPOSITORY/$PROJECT/trunk 
 +# alternatively: svn merge -r 303:302 https://svn.ms.mff.cuni.cz/svn/$REPOSITORY/$PROJECT/trunk 
 +svn status 
 +svn diff 
 +svn commit -m "Undoing change committed in r303."</code> 
 + 
 +===== 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 414: Line 489:
 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): ''<nowiki>svn merge -r 474:475 file:///fs/clip-mteval/svn/Programs/branches/bittorrent .</nowiki>'' 
- +  * Change your mind when you realize those bug fixes did more harm than good: ''<nowiki>svn merge -r 475:474 file:///fs/clip-mteval/svn/Programs/branches/bittorrent .</nowiki>''
-: $ 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 .'' +===== Troubleshooting =====
- +
-: $ 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 ===+
  
 If you get the message: If you get the message:
Line 448: Line 517:
 * pray * pray
  
-=== 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: 
  
-* [http://svnbook.red-bean.com/nightly/en/svn.basic.html Chapter 2: Basic Concepts].  This is an intro to version control concepts; if you are familiar with the basic ideas, you can probably skip this chapter.  Covers concepts such as repositories, working copies, and copy-modify-merge version control. +===== Further Reading ===== 
-* [http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html Section 3.5: Basic Work Cycle].  Covers 90% of what you will need to know about using subversion, in about fifteen minutes.  If you don't read anything else, read this section, and you'll be able to get started very quickly. + 
-* [http://svnbook.red-bean.com/nightly/en/svn.tour.html Chapter 3: Guided Tour].  Includes the above (Section 3.5) as well as some additional details.  This is 95% of what you need to know. +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: 
-* [http://svnbook.red-bean.com/nightly/en/svn.branchmerge.html Chapter 4: Branching and Merging]. This is the other 5%.  If you are working on merging changes into the main branch of code, look here. + 
-* [http://svnbook.red-bean.com/nightly/en/svn.ref.html Chapter 9: Subversion Complete Reference].  Compact documentation on all of the command-line tools and their options.  This isn't something you need to read front-to-back, but rather, where you should look if you can't remember a particular command-line option.+  Nečíslovaný seznam [[http://svnbook.red-bean.com/nightly/en/svn.basic.html|Chapter 2: Basic Concepts]].  This is an intro to version control concepts; if you are familiar with the basic ideas, you can probably skip this chapter.  Covers concepts such as repositories, working copies, and copy-modify-merge version control. 
 +  [[http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html|Section 3.5: Basic Work Cycle]].  Covers 90% of what you will need to know about using subversion, in about fifteen minutes.  If you don't read anything else, read this section, and you'll be able to get started very quickly. 
 +  [[http://svnbook.red-bean.com/nightly/en/svn.tour.html|Chapter 3: Guided Tour]].  Includes the above (Section 3.5) as well as some additional details.  This is 95% of what you need to know. 
 +  [[http://svnbook.red-bean.com/nightly/en/svn.branchmerge.html|Chapter 4: Branching and Merging]]. This is the other 5%.  If you are working on merging changes into the main branch of code, look here. 
 +  [[http://svnbook.red-bean.com/nightly/en/svn.ref.html|Chapter 9: Subversion Complete Reference]].  Compact documentation on all of the command-line tools and their options.  This isn't something you need to read front-to-back, but rather, where you should look if you can't remember a particular command-line option.
  
 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.
  

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