Re: [hook-script] new pre-commit script to add bugzilla urls to log messages
Jon Bendtsen <[email protected]> Fri, 9 Sep 2005 17:42:37 +0200
| Newsgroups | gmane.comp.version-control.subversion.devel,gmane.mail.eyebrowse.user |
|---|---|
| Message-ID | <C9773D7A-1C4C-461F-8C14-73770C57480D__44112.000676296$1126280978$gmane$org@laerdal.dk> |
Den 9. sep 2005 kl. 17:24 skrev Philip Martin: > 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: Yeah i know, but i couldnt find any other way to change it before committing. > #!/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) Why are these language bindings not documented on the web? At least not in anyplace i have looked. Naturally i look from http://subversion.tigris.org/ and i've been looking under Documents & files the subversion book development. I just cant find it. Maybe if the language bindings was more easily found i would not have used the wrong way to do things. And it's not like it is the first time i've been looking for the language bindings. Back when i made a patch for mailer.py i looked after them as well, but the documentation is gone. JonB