SVN Como forzar un comentario al realizar un Commit en Subversion

Ira al directorio llamado hooks dentro del repositorio:

cd /svn/projectname/hooks

Crear un fichero llamado pre-commit.

vi pre-commit

Pegar el siguiente código en dicho fichero, este forzará un comentario de como mínimo 10 o mas carácteres al realizar un commit.

Podéis pillar el txt en formato plano en:

Quizás será necesario adaptar líneas como /usr/local/bin/python o /usr/local/bin/svnlook

Subversion pre-commit hook which currently checks that the commit contains
a commit message to avoid commiting empty changesets which tortoisesvn seems
to have a habbit of committing.

Based on
and hooks/pre-commit.tmpl

Hacked together by Jacques Marneweck


import sys, os, string


def main(repos, txn):
log_cmd = ‘%s log -t “%s” “%s”‘ % (SVNLOOK, txn, repos)
log_msg = os.popen(log_cmd, ‘r’).readline().rstrip(‘n’)

if len(log_msg) < 10:
sys.stderr.write (“Please enter a commit message which details what has changed during this commit.n”)

if __name__ == ‘__main__’:
if len(sys.argv) < 3:
sys.stderr.write(“Usage: %s REPOS TXNn” % (sys.argv[0]))
main(sys.argv[1], sys.argv[2])