SVN Code+Document repository


SVN Repository by LHC Higgs XS WG


Getting started with SVN and how to check out the repository

  • SVN (Subversion) is a tool to manage changes within their source code tree.
  • lxplus.cern.ch is the best machine to work. Also MAC OS-X knows SVN.
  • Our repository (lhchiggsxs) can be accessed via checkout using on off the URL's (ssh is faster)::
       svn co svn+ssh://svn.cern.ch/reps/lhchiggsxs/documents
       svn co https://svn.cern.ch/reps/lhchiggsxs/documents
       or  
       svn co svn+ssh://svn.cern.ch/reps/lhchiggsxs/repository
       svn co https://svn.cern.ch/reps/lhchiggsxs/repository
       
  • Add underneath subdirectory name in the end of above commands (documents or repository) if you want to checkout partially.

How to Edit CERN Yellow Report "Handbook of LHC Higgs Cross Sections"

  1. Please do "svn update" before you start editing !!!
  2. Please make sure that LaTeX compiles normally before committing to SVN !!!

Aqua led Practical guide on SVN

Principle is that:
  1. First you download (checkout) the latest files at the SVN server at CERN to your local machine.
  2. Edit file, create/move/copy/delete new file/directory, whatever you want at your local machine.
  3. Then reflect (commit) your changes to the SVN server at CERN.

Green led How to modify the file

  • Maybe it is a good idea to delete very old files at your local machine via rm -rf cernrep4 .

1) First "checkout" the files on SVN onto your local directory. ex. at lxplus.cern.ch, at your local Linux/MAC/Windows (MAC knows svn)

   svn co svn+ssh://svn.cern.ch/reps/lhchiggsxs/documents/Yellow_Report/cernrep4
      (on lxplus)
   or
   svn co svn+ssh://username@svn.cern.ch/reps/lhchiggsxs/documents/Yellow_Report/cernrep4
      (on local Linix/MAC/Windows, then enter the password at CERN)
               * Beware username on svn.cern is account at cern and could be different from your local id. 
               * Password is requested twice.
   

This creates the directory "cernrep4" at your local machine.

2) Go to source file directory

   cd cernrep4/trunk
               * Beware this directory is copied into your local disk.
   

3) You can edit/modify/create files at the same directory at your local disk.

4) Make sure that LaTeX compilation is OK by typing "make" (Makefile)

   make
   

It is sometimes good idea to clean up your local files.

   $ make clean
   rm -f *.aux *.log *.bbl *.blg *.brf *.cb *.ind *.idx *.ilg *.inx *.dvi *.toc *.out *~ ~* spellTmp
   

5) Make sure that someone else changed the same file during you are editing.

   svn update
   

6) Commit your changes to SVN server at CERN

   svn ci -m "enter your comments" filename
   

Yellow led How to import files

  • You can register new files at your local via svn import command to copy them to SVN.
  • If you specify local directory, all the files under that directory are imported at once.
       svn import directory svn+ssh://username@svn.cern.ch/reps/lhchiggsxs/documents/Yellow_Report/cernrep4/trunk/XXX/directory
       svn import filename svn+ssh://username@svn.cern.ch/reps/lhchiggsxs/documents/Yellow_Report/cernrep4/trunk/XXX/filename
       

Red led Useful SVN Commands

  • In SVN, it is always three steps,
  1. do something at your local disk,
  2. tell SVN that you added/modified something, "svn command options",
  3. change will be only effective only after you commit to SVN via "svn ci -m "your message for log" options".

  • Please check useful SVN commands in various documents, or from SVN Book

1) Add new file or folder ( svn add )

  • Copy new file into current directory, then "add" the file, then "commit" the change to SVN.
    svn add filename
    svn ci -m "enter your comments" filename
                   * Password is requested. 
    

2) Delete file or folder ( svn del/delete/rm/remove )

   svn del filename
   

3) Rename/Move file ( svn mv/move/ren/rename )

   svn mv filename new_filename
   

4) Copy files/directory to other place ( svn cp/copy filename/directory destination )

   svn cp directory ../new_directory    (example)
   

Gray led What to do when conflicts are found (commit fail) ?

  • During you are editing the file, someone else might have modified the file and committed it to SVN.
  • In such case, when you commit your update to SVN, an error message will be displayed.
  • It is always recommended that you type "svn update" before you start editing the file.

1) Try "svn update" to reflect the modification by other parties to your local machine, and edit the file to resolve the conflicts.

  • SVN will automatically check the modification and will try to merge them.
  • When conflicts are found, Type df (display difference), p (mark up conflicts) etc., and modify the file (maybe manually).
       $ svn update
      Conflict discovered in 'ABC.tex'.
      Select: (p) postpone, (df) diff-full, (e) edit,
              (h) help for more options:
       

2) After resolving the conflicts, type "svn resolved" so that you can commit to SVN.

   svn resolved <file name>
   

3) You can also try "svn revert ABC.tex" to delete all your changes to working copy, "svn status" to check the status of changes you added to the working copy.

-- ReiTanaka - 20-Feb-2010

Edit | Attach | Watch | Print version | History: r32 < r31 < r30 < r29 < r28 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r32 - 2016-12-13 - ReiTanaka
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCPhysics All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback