Tools/subversion
From GDCM Wiki
Contents |
Subversion (svn) Basics
Most of the command are copied from cvs. Only one shortcut is missing as far as I know:
svn dif
which can be either
svn diff
or
svn di
To update repository:
svn update
To check the changes you made on your working directory:
svn status
To add new file:
svn add filename
To remove file:
svn remove filename
To rename file:
svn move oldname newname
If the update results in conflict, fix the file first before commiting it.
Commit files
In Subversion you don't need any global configuration file, everything is done on a per project basis. All you need to do is retrieve the repository you want to work on. Then you only need (once!) to specify your username if different from your UNIX username.
$ svn commit --username malat -m"ENH: svn rocks"
Resolve conflicts
$ svn update At revision 33.
So no particular file is marked as conflicting (with letter: C), but:
$ svn ci -m"COMP: Getting everything to compile" svn: Commit failed (details follow): svn: Aborting commit: '/full/path/to/MyClass.h' remains in conflict
therefore you need to explicitely say you resolved the conflict:
$ svn resolved /full/path/to/MyClass.h Resolved conflicted state of '/full/path/to/MyClass.h'
$ svn ci -m"COMP: Getting everything to compile" Sending MyClass.h Transmitting file data ... Committed revision 34.
svn diff usage
diff (di): Display the differences between two paths.
usage: 1. diff [-r N[:M]] [TARGET[@REV]...]
2. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \
[PATH...]
3. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]
Example:
cd gdcm svn diff -r 276:278
CVS and svn:keywords equivalent
$ svn propset svn:keywords "Date Id" myfile.cxx $ svn commit $ head myfile.cxx Date: $Date: 2006-01-26 12:03:52 -0500 (Thu, 26 Jan 2006) $ Id: $Id: myfile.cxx 784 2006-01-26 17:03:52Z malaterre $
Feature missing from CVS
Ref: http://kitt.hodsden.com/ignoring_whitespace_changes_with_svn_diff
When using Subversion, a recent successor to the ubiquitous CVS revision control system, one may notice certain niceties of CVS are lost.
In particular, the -w flag on cvs diff.
cvs diff will display changes in the local file. Without the -r flag to specify which version is being compared, the default is to compare the local file to the currently tagged version in the repository, or the main branch HEAD if the file is not tagged.
cvs diff -w will display all non-whitespace changes. White space changes include adding or removing tabs or spaces, or changing spaces to tabs. New lines are still included in the diff.
Subversion doesn't have this shortcut. To ignore whitespace changes, you must use an external diff program with subversion:
svn diff filename --diff-cmd `which diff` -x "-w"
You can specify a different diff, such as xdiff, xxdiff, as a value to the --diff-cmd argument, but be sure to include the full path. If you want to pass more values to your diff command, include them in the -x argument value, which is passed along directly to the diff command:
svn diff -r123:126 filename --diff-cmd /path/to/diff -x "-u -w"
If you want, you can also create an alias for this. In tcsh:
alias svndiff 'svn diff --diff-cmd `which diff` -x "-w" \!*'
Issues
$ svn co https://svn.sourceforge.net/svnroot/gdcm Unrecognized URL scheme
This happen when your svn client does not support https/ssl. Make sure you build/installed svn and https/ssl
Other issue:
svn: Commit failed (details follow): svn: DELETE of '/svnroot/gdcm/!svn/wrk/2b82caf1-c817-0410-b815-c22f9bdcee66/Utilities/jpeg_ls': Could not read response body: Secure connection truncated (https://svn.sourceforge.net)
Seems like you only need to do:
svn update
and then try to commit again, seems to solve issue.
Password are stored in clear
http://subversion.tigris.org/faq.html#plaintext-passwords
Setting file explicteitly to be binary
svn propset svn:mime-type application/octet-stream bla*
External links
The book: http://svnbook.red-bean.com/nightly/en/index.html
Appendix A. Subversion for CVS Users: http://svnbook.red-bean.com/nightly/en/svn.forcvs.html
Conflict Resolution: http://svnbook.red-bean.com/nightly/en/svn.forcvs.conflicts.html
svn:keywords: http://svnbook.red-bean.com/nightly/en/svn.advanced.props.html#svn.advanced.props.special.keywords
Suversion vs CVS
- http://better-scm.berlios.de/comparison/comparison.html
- http://www.opensolaris.org/os/community/tools/scm/
- http://en.wikipedia.org/wiki/List_of_revision_control_software
--malat 05:50, 28 June 2006 (PDT)
