Hi, I'm trying to validate the log message using the new 1.8 start-commit capability of inspect the transaction beeing created.
My problem is that if the client is using an older version (like 1.7) the commit message obtained using svnlook is always empty durng the start-commit. In this case the commit message is available only during pre-commit. All of this is is working well if the client is using 1.8 version. The text bellow is an copy of my start-commit hook: #!/usr/bin/env python # The start-commit hook is invoked before a Subversion txn is created # in the process of doing a commit. Subversion runs this hook # by invoking a program (script, executable, binary, etc.) named # 'start-commit' (for which this file is a template) # with the following ordered arguments: # # [1] REPOS-PATH (the path to this repository) # [2] USER (the authenticated user attempting to commit) # [3] CAPABILITIES (a colon-separated list of capabilities reported # by the client; see note below) # [4] TXN-NAME (the name of the commit txn just created (1.8 or newer)) # import sys import subprocess def get_svn_log(txn, repos): child = subprocess.Popen(['/usr/bin/svnlook','log','-t',txn,repos],stdout=subprocess.PIPE,stderr=subprocess.PIPE) out,err = child.communicate() if child.returncode: return ('',err) return (out,'') repo = sys.argv[1] capabilities = sys.argv[3].split(':') txn = sys.argv[4] if 'mergeinfo' not in capabilities: sys.stderr.write('Commits from merge-tracking-unaware clients are not permitted.\n' 'Please upgrade to Subversion 1.5 or newer.\n') sys.exit(1) log, err = get_svn_log(txn,repo) if err: sys.stderr.write('Error verifying log message: '+err) sys.exit(1) elif not log.strip(): sys.stderr.write('Commits without log message are not permitted.\n' 'Please enter the log message.\n') sys.exit(1) sys.exit(0)