SVN Commit

From Daya Bay
Jump to navigation Jump to search
This page was derived from NTU|env|wiki:SVN_Commit (http://dayabay.phys.ntu.edu.tw/tracs/env/wiki/SVN_Commit)


SVN Commit

This page describes the steps of committing local changes made to working copy into the repository. Note this working approach of keeping all you changes in local working copy is only appropriate for small changes. For larger changes adopting standard subversion Branch/Merge working practices is highly recommended. This is described on db:SVN_Merge which is linked from db:SVN_Repository.

Recipe for doing a commit

  • Check where the current directory corresponds to in the repository :
  cd $DYW/G4dyb
  svn info

Path: .
URL: http://dayabay.ihep.ac.cn/svn/dybsvn/legacy/trunk/G4dyb
Repository Root: http://dayabay.ihep.ac.cn/svn/dybsvn
Repository UUID: 9a4306ee-3332-0410-9a75-a644b53ef5af
Revision: 1749


  • See what files are locally changed and what is changed in the repository:
   svn help status   ## summary help 
   svn status -u     
       *     1749   include/dyw_PMT_LogicalVolume.hh
       *     1749   include/dywDetectorMessenger.hh
       *     1749   include/dywDetectorConstruction.hh
       *     1749   include/dywPMTOpticalModel.hh
       *     1749   src/dyw_PMT_LogicalVolume.cc
       *     1749   src/dywDetectorMessenger.cc
       *     1749   src/dywConstructNearSitePool.cc
       *     1749   src/dywAnalysisManager.cc
       *     1749   src/dywConstructAberdeenLab.cc
       *     1749   src/dywConstructNearSitePool_CD1.cc
       *     1749   src/dywConstructNearSitePool_CDR.cc
       *     1749   src/dywConstructPrototype.cc
       *     1749   src/dywConstructDYBDetector.cc
       *     1749   src/dywConstructFarSite_OctagonalPool.cc
       *     1749   src/dywDetectorConstruction.cc
       *     1749   src/dywConstructOneModuleAlternative.cc
       *     1749   src/dywConstructOneModule.cc
?                   cmt/load.C
?                   cmt/tmp


  • If there are modifications in the repository (indicated by *) you must update before doing any checkins:
   svn help update
   svn update
   svn status -u

Look carefully at the status codes from the update, especially for "C" for conflict and "G" for merged. Manually resolve any conflicts db:ConflictResolution


  • Add new files
   svn help add
   svn add include/dywEtcetera.hh
   svn add  src/dywEtcetera.cc
  • Oops, I did not mean to add a file or a directory (use --recursive for directory and all its subdirectories and files).
 svn help revert
 svn revert src/dywEtcetera.cc
 svn revert --recursive src 
  • A better way to svn add
  • Perform commits or check-ins ci .If no path is specified to the svn ci the default is the current directory. Doing this is not recommended unless you are very sure regarding the status of all files in the current directory. Its safer to be more specific and check in just the paths you have been working on. If you want to enter a long commit, or just like using an editor, export SVN_EDITOR=emacs or whatever editor you prefer, then omit -m from the commit line.
   svn help ci
   svn ci include/Etcetera.hh include/Other.hh -m "message concerning the change"
   svn ci  src/Etcetera.cc  src/Other.cc -m "commit message "