Re: [hook-script] new pre-commit script to add bugzilla urls to log messages
Philip Martin <[email protected]> Fri, 09 Sep 2005 16:24:09 +0100
| Newsgroups | gmane.comp.version-control.subversion.devel,gmane.mail.eyebrowse.user |
|---|---|
| Message-ID | <87wtlqmfhi.fsf__49313.4953700521$1126279872$gmane$org@debian2.lan> |
Jon Bendtsen <[email protected]> writes: > I have made a pre-commit hook script that adds bugzilla urls to log > messages. > It is a bash shell script, and it uses cut, sed, grep, echo, ... > It works on my debian stable using subversion 1.2.0-1 from testing? > > This script CHANGES the props file in the transaction directory. Eeek! Modifying the database files directly is not recommended. It would be better to use the language bindings: #!/usr/bin/python import sys sys.path.append('/usr/local/subversion/lib/svn-python') from svn import repos, fs repos_handle = repos.open(sys.argv[1]) fs_handle = repos.fs(repos_handle) txn_handle = fs.open_txn(fs_handle, sys.argv[2]) log_msg = fs.txn_proplist(txn_handle)['svn:log'] log_msg = log_msg + ' modified' # do the fancy bug URL stuff here fs.change_txn_prop(txn_handle, 'svn:log', log_msg) -- Philip Martin