RE: Issue related to pre-commit hook
| Newsgroups | gmane.comp.version-control.subversion.tortoisesvn.devel |
|---|---|
| Message-ID | <73CF5EDFF695104B94D02B83FE19A5A96CFDB41E@USSTLZ-PMSG008.emrsn.org> |
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:[email protected]]
Sukhada Bhide | Desk: +91(20)42001672
From: Simon Large [mailto:[email protected]]
Sent: Wednesday, January 27, 2016 10:28 PM
To: [email protected]
Subject: Re: Issue related to pre-commit hook
On 27 January 2016 at 06:36, <[email protected]<mailto:[email protected]>> 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: [[email protected]].
image001.jpg
(image/jpeg, 83.3 KB) - not displayed