[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

start-commit log message.

From: Carlos Alberto Costa Beppler <beppler_at_gmail.com>
Date: Tue, 31 Mar 2015 08:18:24 -0700 (PDT)

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)
Received on 2015-03-31 17:23:35 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.