User Tools

Site Tools


svn

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
svn [2007/09/04 07:06] cangianisvn [2012/02/17 14:54] (current) damir
Line 1: Line 1:
 ====== Subversion ====== ====== Subversion ======
  
-Subversion is an open-source control version system that is a compelling replacement for CVS. At least the client version is installed by default on all our Linux machines, and can be easily installed on Macs via [[http://fink.sf.org|fink]] or [[http://www.macports.org|macports]]. +Subversion is an open-source control version system that is a compelling replacement for CVS. At least the client version is installed by default on all our Linux machines, and can be easily installed on Macs via [[http://fink.sf.org|fink]] or [[http://www.macports.org|macports]].\\  
-The basic idea is to keep a master copy of your source files in a //repository// where the subversion also keeps track of all the (committed) modifications to the files. +The basic idea is to keep a master copy of your source files in a //repository// where the subversion also keeps track of all the (committed) modifications to the files. For editing a file, one have to check it out (e.g. get a local copy) from the repository.\\  
-For editing a file, one have to check it out (e.g. get a local copy) from the repository. Once the editing is done, the modifications are committed back to the server. This allows more than one person (or the same person on many computers) to work on the same set of files because they are actually working on their local copy of the files. +Once the editing is done, the modifications are committed back to the server. This allows more than one person (or the same person on many computers) to work on the same set of files because they are actually working on their local copy of the files.\\  
-When a user commits his changes, the files he has been editing might have been changed (and committed) by another user in the mean while. In this case, subversion merges the changes automatically unless it detects a conflict (e.g. two user having changed the same line of code).+When a user commits his changes, the files he/her has been editing might have been changed (and committed) by another user in the mean while. In this case, subversion merges the changes automatically unless it detects a conflict (e.g. two user having changed the same line of code).
 Everyone can create his own subversion repository in his homedirectory with the following command: Everyone can create his own subversion repository in his homedirectory with the following command:
 <code> <code>
Line 10: Line 10:
 </code> </code>
 where ''DIRECTORY_NAME'' name could be for example ''/home/cangiani/SVN'' where ''DIRECTORY_NAME'' name could be for example ''/home/cangiani/SVN''
 +===== Standard connection methods for our central repositories =====
  
 For group projects, it is better to use the common repository which is For group projects, it is better to use the common repository which is
-  * for algo: <nowiki>svn+ssh://USERNAME@clusteralgo.epfl.ch/SVN/trunk</nowiki> +  * for algo: <nowiki>svn+ssh://USERNAME@lth.epfl.ch/repos/algo/REPONAME/</nowiki> 
-  * for licos: <nowiki>svn+ssh://USERNAME@licos.epfl.ch/SVN/trunk</nowiki> +  * for licos: <nowiki>svn+ssh://USERNAME@lth.epfl.ch/repos/licos/REPONAME/</nowiki> 
-  * for lth: <nowiki>svn+ssh://USERNAME@lth.epfl.ch/svnlth/</nowiki> +  * for lth[c|i]: <nowiki>svn+ssh://USERNAME@lth.epfl.ch/repos/lth/REPONAME</nowiki> 
-  * for lcm: <nowiki>svn+ssh://USERNAME@lth.epfl.ch/svnlcm</nowiki>+  * for lcm: <nowiki>svn+ssh://USERNAME@lth.epfl.ch/repos/lcm/REPONAME/</nowiki
 +  * for arni: <nowiki>svn+ssh://USERNAME@lth.epfl.ch/repos/arni/REPONAME</nowiki> 
 +  * for lapmal: <nowiki>svn+ssh://USERNAME@lth.epfl.ch/repos/lapmal/REPONAME</nowiki> 
 +  *  
 +Where ''REPONAME'' is the name of the repository. You can see a list of repositories with ''ls''.  
 +For example: 
 + 
 +<code> 
 +|~>ls /repos/lth 
 +CDMA introsc scaling 
 +CS iryna scripts 
 +LDPCequal isit05 shortcourse 
 +SourceCoding it2010-11 signalpc 
 +SourceCodingBP iterations sim 
 +aaaaa kr sim.donotuse 
 +abdel ldlc sim1 
 +alsan ldpcdemo sim_zip 
 +ara leshouches sparsematrices 
 +aref limex stability 
 +book mac statphys 
 +cap matlabde statphys2010-11 
 +cdi maxup subroutines 
 +comm maxwell talks 
 +commnet minsum temp 
 +consensus mobility test 
 +corrdecay ncaref test1 
 +coupled netflix testacl 
 +cyclecodes networkcoding testacl1 
 +densevol newintrosc testdamir 
 +density_evolution paris05 thesiskorada 
 +dsp2010-11 pdc treereconstruction 
 +errorfloor polargaussian turbo 
 +flipping polarization turboweight2 
 +gf pspin twod 
 +girthvsdiam puncturing vinodhPhD 
 +gossip racodes vish 
 +graphreconstruction ratesplitting weight_conc 
 +ibm samplede 
 +</code>
  
 ===== Quick User Guide ===== ===== Quick User Guide =====
  
-Almost everything is done with the ''svn'' command. In fact it is a //super// command as it accepts many internal commands. Note that in this section, all the lines starting with ''xxxx>'' are commands that I typed in as an example. By ''URL'' , I mean a repository address as, for example ''svn+ssh: USERNAME@licos.epfl.ch/SVN/trunk''. Arguments in square brackets are optionals. All commands that do not need an ''URL'' are going to be used from withing a local copy under version control.+Almost everything is done with the ''svn'' command. In fact it is a //super// command as it accepts many internal commands. Note that in this section, all the lines starting with ''xxxx>'' are commands that I typed in as an example. By ''URL'' , I mean a repository address as, for example ''svn+ssh: USERNAME@lth.epfl.ch/licos/SVN/trunk''. Arguments in square brackets are optionals. All commands that do not need an ''URL'' are going to be used from withing a local copy under version control.
 <note> <note>
 For a guide of CVS to SVN command follow [[http://svn.collab.net/repos/svn/trunk/doc/user/cvs-crossover-guide.html|this]] link. For a guide of CVS to SVN command follow [[http://svn.collab.net/repos/svn/trunk/doc/user/cvs-crossover-guide.html|this]] link.
Line 32: Line 71:
 to list the content of the [remote] repository. For example: to list the content of the [remote] repository. For example:
 <code> <code>
-licos>svn list svn+ssh://cangiani@licos.epfl.ch/SVN/trunk +damir@iscsrv7:~$ ls /repos/lth 
-web/ +aaaaa      coupled              introsc         matlabde       polarization       sim.donotuse     testacl 
-licos>svn list svn+ssh://cangiani@licos.epfl.ch/SVN/trunk/web +abdel      CS                   iryna           maxup          pspin              sim_zip          testacl1 
-.htaccess.wait +alsan      cyclecodes           isit05          maxwell        puncturing         SourceCoding     testdamir 
-BioReadingGroup/ +ara        densevol             it2010-11       minsum         quantique-2010-11  SourceCodingBP   thesiskorada 
-Papers/ +aref       density_evolution    iterations      mobility       racodes            sparsematrices   treereconstruction 
-TODO +book       dsp2010-11           kr              ncaref         ratesplitting      stability        turbo 
-courses/ +cap        errorfloor           ldlc            netflix        samplede           statphys         turboweight2 
-css+cdi        flipping             ldpcdemo        networkcoding  scaling            statphys2010-11  twod 
-error/ +CDMA       gf                   LDPCequal       newintrosc     scripts            subroutines      vinodhPhD 
-img_base/ +comm       girthvsdiam          leshouches      NIPS           shortcourse        talks            vish 
-inc/ +commnet    gossip               limex           paris05        signalpc           temp             weight_conc 
-index.php +consensus  graphreconstruction  loop_expansion  pdc            sim                test 
-licos/ +corrdecay  ibm                  mac             polargaussian  sim1               test1 
-proj+ 
-pubs+damir@iscsrv7:~$ svn list svn+ssh://lth.epfl.ch/repos/lth/sim 
-research/+36_BAWGNC_BP.ps 
 +36_BAWGNC_BP_5.13625_7.ps 
 +36_BAWGNC_MinSum.ps 
 +36_BAWGNC_MinSum_5_10.ps 
 +36_BEC_BP.ps 
 +36_BSC_BP.ps 
 +data
 +log 
 +param 
 +param36_1024_BEC_BP 
 +param36_8192_BSC_matched 
 +parambec 
 +plotheader.ps 
 +plotmidsection.ps 
 +plottrailer.ps 
 +pp36_1024_BEC_BP 
 +pp36_8192_BSC_BP_matched 
 +ppfiles
 +pptops 
 +pptops36_BEC_BP 
 +protographexample 
 +pstemplate.ps 
 +scaling.ps 
 +simfiles
 +trunk/ 
 </code> </code>
  
Line 54: Line 118:
 to get a local copy of [part of] the repository. For example, with to get a local copy of [part of] the repository. For example, with
 <code> <code>
-licos> cd public_html +damir@iscsrv7:~$ mkdir test 
-licos> svn checkout svn+ssh://cangiani@licos.epfl.ch/SVN/trunk/web licos+damir@iscsrv7:~$ cd test 
 +damir@iscsrv7:~/test$ svn co svn+ssh://lth.epfl.ch/repos/lth/sim sim
 </code> </code>
-I would get a copy of the licos web site in my %%public_html/licos%% directory so that it can be seen from %%http://licos.epfl.ch/~cangiani/licos%%. The %%licos%% directory name above is not mandatory. If omitted svn +I would get a copy of the sim program source code inside the just created test directory. 
-will just use the name of the last directory in the repository (in this case "web"). Now that I have my local copy under version control I can run all the following commands.+The %%sim%% directory name above (the last parameter in the svn co command line) is not mandatory. If omittedsvn 
 +will just use the name of the last directory in the repository (in this case "sim"). Now that I have my local copy under version control I can run all the following commands.
  
 ==== svn status [-u] ==== ==== svn status [-u] ====
Line 136: Line 202:
 ------------------------------------------------------------------------ ------------------------------------------------------------------------
 </code> </code>
 +
 +===== Personal Repositories =====
 +
 +you can always create a personal repository in your homedir by doing:
 +
 +  - ssh into server: <code>ssh lth.epfl.ch</code>
 +  - create an empty repository: <code>svnadmin create <name_of_repository></code> 
 +  - use the standard svn subcommands to checkout, list or commit to the repository
 +
 +
 +===== General Repositories =====
 +
 +General repositories, that needs to be available under <code>ssh+svn://lth.epfl.ch/svn<LABNAME>/<REPOSITORY></code> can be created only by the System Administrators.\\
 +To create a general repository you need to send an email with these informations:
 +  - name of the repository
 +  - list of users that need access to it
 +  - visibility:
 +    - Private: The repository can be private (the only way to access it is through the svn commands)
 +    - Public: The repository can be accessed through the web interface 
  
 ===== Few general recommendations ===== ===== Few general recommendations =====
-  - try to import into subversion ONLY the SOURCES and not the files that are generated from the sources;+  - try to import into subversion ONLY the SOURCES and not the files that are generated from the sources; use [[makegallery|Makefiles]] for automatically generating dependent files from sources.
   - try to keep the repository as clean as possible. If the repository is shared among various users, it is better to meet once and agree on a common strategy for file/directories naming schemes;   - try to keep the repository as clean as possible. If the repository is shared among various users, it is better to meet once and agree on a common strategy for file/directories naming schemes;
   - Unless you have a good reason, do not commit incomplete or buggy files;   - Unless you have a good reason, do not commit incomplete or buggy files;
-  - **Important: filesystem compatibility**. Like any other file synchronizer, SVN gets into troubles when you try to synchronize (i.e., checkout or update) a directory where you you make explicit use of case sensitiveness for file names. While filesystems on linux (and most unix variants) are case sensitive, all filesystems on Windog and the default one on Mac OsX are case insensitive.  This means that the files ''fig1.eps'' and ''Fig1.eps'' are distinct on linux, but idistinguishable under osX and SVN will not be able to treat them because it cannot arbitrarily change names to your files to make them uniq.+  - **Important: filesystem compatibility**. Like any other file synchronizer, SVN gets into troubles when you try to synchronize (i.e., checkout or update) a directory where you you make explicit use of case sensitiveness for file names. While filesystems on linux (and most unix variants) are case sensitive, all filesystems on Windog and the default one on Mac OsX are case insensitive.  This means, for example, that file ''fig1.eps'' and file ''Fig1.eps'' are two distinct files under Linux, but they are mapped to the same physical file, and therefore they cannot co-exist under OsX.
  
 +===== Various Tips & Tricks =====
 +==== Global Configuration ====
 +Every user has a personal global SVN configuration file which resides in ''~/.subversion/config''. This file defines options that are valid for all repositories that the user works with. 
 +
 +The two most useful options are probably ''global-ignores'' and ''autoprops''. ''global-ignores'' defines a list of filename patterns that Subversion will ignore. For example, you can set it to
 +<code>
 +global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store \
 + .*.swp *.dvi *.aux *.log *.bbl *.blg *.idx *.ind *.ilgglobal-ignores = *.o *.lo *.la #*# 
 +</code>
 +to ignore the specified files. The command ''svn status'' will then no longer display these types of files preceded with a question mark if they are not in a repository.
 +One should be careful with ''*.log'' as its possible there are files other than LaTeX processing files which end in ''.log''. To see which files are being ignored in a given directory, type 
 +  svn st --no-ignore
 +
 +The option ''autoprops'' causes Subversion to automatically set pre-defined properties for files whose names satisfy a given pattern. For example,
 +<code>
 +[auto-props]
 +*.m = svn:keywords=Id
 +*.tex = svn:keyword=Id
 +</code>
 +makes Subversion to automatically set the ''Id'' keyword for all .m and .tex files that are added to a repository. (The ''Id'' keyword tells Subversion that the string ''$Id$'' in a file should be expanded to something like
 +  $Id: sufficiency.tex 372 2008-02-11 16:10:53Z kleiner $
  
 +==== Per-Directory Ignore List ====
 +While the ''global-ignores'' option explained above already covers a lot of cases, there are situations where you want Subversion to ignore a file that you cannot put in the global ignore list. For example, in a directory that contains a tex file, you'll want Subversion to ignore the corresponding ps or pdf files. Since you don't want Subversion to ignore //all// ps and pdf files everywhere, you cannot use ''global-ignores''. However, each directory in a Subversion repository has its own //ignore list//. You can edit a directory's ignore list by typing
 +  svn propedit svn:ignore .
 +(the ''.'' is part of the command; it indicates the current directory). This will fire up an editor (the one defined in the ''$EDITOR'' environment variable), in which you can then edit  and save the directory's ignore list. 
svn.1188889602.txt.gz · Last modified: 2007/09/04 07:06 by cangiani