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

RE: Issue related to pre-commit hook

From: <Sukhada.Bhide_at_emerson.com>
Date: Thu, 28 Jan 2016 09:38:47 +0000

Simon,

Yes version 1.7 supports hook, we have applied those for other projects and its working.

I am copying contents of pre-commit.cmd file as given below :

-------------------------------------------------------------------------------------------------------------------------------------------------
setlocal

set REPOS=%1
set REV=%2

set PATH=c:\python27;
python.exe "C:\Repositories\Project\hooks\pre-commit-hook.py" %REPOS% %REV%

--------------------------------------------------------------------------------------------------------------------------------------------------

And also below are contents of “pre-commit-hook.py”

"""
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

http://svn.collab.net/repos/svn/branches/1.2.x/contrib/

hook-scripts/commit-block-joke.py and hooks/pre-commit.tmpl

Hacked together by Jacques Marneweck
Adapted for Windows by Quan Eastin and
Jim Pickering

Under Windows and Python 2.5, the output of SVNLOOK was lost
causing an error for EVERY commit... I modified the code to use the
subprocess library. Julian Easterling

"""

import sys, os, string
import subprocess

SVNLOOK='C:\\"Program Files (x86)"\\"VisualSVN Server"\\bin\\svnlook.exe'

def main(repos, txn):
  log_cmd = '%s log -t %s %s' % (SVNLOOK, txn, repos)

  p = subprocess.Popen(log_cmd,
                         shell=True,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE,
                         stdin=subprocess.PIPE)
  p.stderr.close()
  p.stdin.close()

  log_msg = p.stdout.read().rstrip('\n')

  if len(log_msg) < 10:
    sys.stderr.write ("""It seems the commit log is either not entered or is incomplete.

    Please enter a commit message in format shown below which details what has changed during this commit.""")

    sys.stderr.write ("""

    Changed Files------: Mentioned the names of the changed files.

    Description:
    - Type-------------: Mention whether it is Bug Fix | Requirement change | Requirement Addition.
    - Bug ID-----------: Refer the Bugzilla bug id if applicable.
    - Traceability-----: Refer the EPRF Version and the Section number for reference.
    - Description------: Describe the change done.
    - Compatibility----: Mention if the change is backward compatible.

    Target release-----: Mention the milestone release for which the bug/feature is being worked on.
    """ )

    sys.exit(1)
  else:
    sys.exit(0)

if __name__ == '__main__':
  if len(sys.argv) < 3:
    sys.stderr.write("Usage: %s REPOS TXN\n" % (sys.argv[0]))
  else:
    main(sys.argv[1], sys.argv[2])

Issue is we are not able to get following message :

    Changed Files------: Mentioned the names of the changed files.

    Description:
    - Type-------------: Mention whether it is Bug Fix | Requirement change | Requirement Addition.
    - Bug ID-----------: Refer the Bugzilla bug id if applicable.
    - Traceability-----: Refer the EPRF Version and the Section number for reference.
    - Description------: Describe the change done.
    - Compatibility----: Mention if the change is backward compatible.

    Target release-----: Mention the milestone release for which the bug/feature is being worked on.

In below window while committing:

[cid:image001.png_at_01D14C82.7ED9FDD0]

Sukhada Bhide | Desk: +91(20)42001672

From: Simon Large [mailto:simon.tortoisesvn_at_gmail.com]
Sent: Wednesday, January 27, 2016 10:28 PM
To: dev_at_tortoisesvn.tigris.org
Subject: Re: Issue related to pre-commit hook

On 27 January 2016 at 06:36, <Sukhada.Bhide_at_emerson.com<mailto:Sukhada.Bhide_at_emerson.com>> wrote:

Dear SVN Helpdesk representative,

Our team is using following version of Tortoise SVN:

TortoiseSVN
A Subversion client for Windows
Version 1.7

This is a very old version of TortoiseSVN. Have you tried the latest version? Did 1.7 even support client side hooks? I don't remember.

I need help regarding pre-commit-hook

Attached is zip file which contains python file “pre-commit-hook.py” which we have configured.

No it doesn't. You can't generally attach code files like .cmd and maybe .py and expect them to get through mail filters. Try pasting the text of the pre-commit hook directly into the email.
This is running as a client-side hook and not a server-side hook, right?

Simon

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=3157426

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].

image001.jpg
Received on 2016-01-28 16:54:16 CET

This is an archived mail posted to the TortoiseSVN Dev mailing list.

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