Version 24 (modified by 17 years ago) ( diff ) | ,
---|
Table of Contents
Getting development information and code history from SVN
- "ChangeLog" style file: install and run svn2cl
- File history in SVN:
cd path/to/directory/ svn log [file.c] # or time reverted: svn log [file.c] | tac
- Bug: svn2cl ChangeLog loses file names at branch point. Problem and possible solution described here: http://article.gmane.org/gmane.comp.gis.grass.devel/26626/ http://article.gmane.org/gmane.comp.gis.grass.devel/26631
Switch the repository
To switch from SVN 'trunk' (now GRASS 7 development) to 'develbranch_6' (now GRASS 6.4 development) use
cd /path/to/your/local/copy/trunk svn switch https://svn.osgeo.org/grass/grass/branches/develbranch_6 .
The switch command preserves local, uncommited changes.
SVN usage
Checkout source code
- See DownloadSource
Before making changes
- Double check that you are using the latest revision of the development branch before embarking on any changes. Example:
svn up raster/r.digit/
Local Diffs
- Before committing a change or submitting a patch you should review the changes. Viewing a diff is a nice way to do that. It is preferable to keep your patches concise- needless whitespace changes or a mixture of tasks can make it difficult to spot subtle changes introduced by your change.
View changes:
svn diff raster/r.digit/
Save patch to a file: (run from top dir not the module dir. There are many "main.c" and "description.html" files to choose from and without the directory name it is hard to figure out where your patch should be applied)
svn diff raster/r.digit/ > fancy_new.diff
Revisit previous Diffs
You can easily check previously checked in changes:
http://trac.osgeo.org/grass/browser/grass/trunk/raster/r.digit/main.c In upper left corner, click: Last Change Revision Log
In the souce code browser directory listing you can click on a file's Rev column to see a list of all changes, then pick two versions of the file and view changes. By clicking on a revisions Chgset number you can see the changes that came with that commit (including changes to other files). By clicking on @Rev column on the "View changes" page you can see the state of the file at that revision.
When following changes with the Timeline you can click on the revision [number] to view changes.
You can get a unidiff from the small link at the bottom of each page, if you prefer that.
See also the ViewCVS web interface mirror of the SVN repository.
Commits back into the repository
(must have write access)
- SVN prefers "atomic commits", i.e. commit changes to all files affected by a change at the same time, not in a series of commits (one for each file).
- Please make the
-m
commit log message meaningful. It is your chance to explain "why". If you refer to bug numbers in the form "#123" the Trac system will automatically create a link from the message to the bug report. The same is true for revision changes, e.g. "r12345".svn diff raster/r.digit/main.c | less svn commit raster/r.digit/main.c \ -m "fix bug #123: uninitialized variable (merge r12345 from trunk)"
Merge between branches (backporting)
Run the command from within the target branch.
- Example 1: pull a change from trunk into the 6.3 release branch:
cd releasebranch_6_3/ svn up raster/r.digit/ svn merge -c 30749 https://svn.osgeo.org/grass/grass/trunk svn diff raster/r.digit/main.c svn commit raster/r.digit/main.c \ -m "fix bug #456: unsafe quoting (merge from trunk, r30749)"
where 30749
is the revision number of the changeset you wish to backport.
- Example 2: merge a change from the 6.4 development branch into GRASS 7 (trunk):
cd trunk/ svn up raster/r.digit/ svn merge -c 31154 https://svn.osgeo.org/grass/grass/branches/develbranch_6 svn diff raster/r.digit/main.c svn commit raster/r.digit/main.c
Non-recursive checkout
- SVN does not allow you to check out a single file at a time. Sometimes this can be awkward as it can force you to checkout the entire repository for the sake of changing one file in the top directory.
Solution: do a
--non-recursive
checkout:
svn checkout --non-recursive https://svn.osgeo.org/grass/grass-web/trunk/ trunk/
File properties
SVN lets you set file properties. For example to get "$Date$" text in help pages to automatically update activate the Date keyword. See "svn help" and "svn help propset" for more information.
Some common tasks:
svn propset svn:keywords "Date" description.html svn propset svn:executable ON g.script.sh svn propset svn:mime-type "application/x-pdf" document.pdf svn proplist ps/ps.map/prolog.ps svn propget svn:mime-type ps/ps.map/prolog.ps