Check out my first novel, midnight's simulacra!
Subversion: Difference between revisions
From dankwiki
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
* '''All commits to a given repopath PATH, with details''' | * '''All commits to a given repopath PATH, with details''' | ||
** <code>svn log -d --xml | xml sel -t -c "//logentry[paths/path='PATH']" | ** <code>svn log -d --xml | xml sel -t -c "//logentry[paths/path='PATH']" | ||
==Hooks== | |||
===Pre-commit=== | |||
<pre>#!/bin/sh | |||
umask 0002 || exit 1 | |||
REPOS="$1" | |||
TXN="$2" | |||
# must use log messages you aloof little bitches | |||
svnlook log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" || { echo "Empty logfiles are disallowed." >&2 ; exit 1 ; }</pre> | |||
[[Category:Source Control]] | [[Category:Source Control]] |
Revision as of 08:58, 13 January 2013
Really, subversion is no longer where it's at (although it's an excellent replacement for cvs, should any unfortunate souls still be using that in this day and age). Try distributed source code control systems like git.
Using subversion with build processes
- Realize that most subversion software, including svnversion and svn-clean, rely on the .svn metadata embedded in checkouts to operate properly. Bundling up this metadata will, generally, roughly double the size of distributed tarballs (especially for repositories with much binary data).
Keeping $HOME in subversion
- Don't keep transient files under control, particularly things like browser cache or bash history.
- Don't keep things like ssh and GnuPG keys in there; use symbolic links and a second repository
XML svn logs
As noted on the xmlstarlet page, svn can generate well-formed XML output for its log command. This can be very handy for writing robust scripts. Use --xml to generate XML, and -v to provide additional data (files edited, etc).
Recipes
- All commits from a given authorname USER, with details
svn log -d --xml | xml sel -t -c "//logentry[author='USER']"
- All commits to a given repopath PATH, with details
svn log -d --xml | xml sel -t -c "//logentry[paths/path='PATH']"
Hooks
Pre-commit
#!/bin/sh
umask 0002 || exit 1
REPOS="$1"
TXN="$2"
# must use log messages you aloof little bitches
svnlook log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" || { echo "Empty logfiles are disallowed." >&2 ; exit 1 ; }