[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: Simon Large <simon.tortoisesvn_at_gmail.com>
Date: Thu, 28 Jan 2016 20:27:45 +0000

Please keep to the mailing list instread of using personal email addresses.

On 28 January 2016 at 11:23, <Sukhada.Bhide_at_emerson.com> wrote:

> Simon,
>
>
>
> This file is kept on server under hook directory.
>
>
>

OK, so this is a server side hook. The server doesn't know you have opened
the commit dialog until you click OK and submit the request, so you are not
going to see the results of your hook in the commit dialog. If the server
rejects it you will get a response in the commit progress dialog which
comes after.

If you only want to prevent short or non-existent commit messages then as
Stefan says, use tsvn:logminsize property. It's a much easier solution.

Simon

> *Sukhada Bhide *| Desk: +91(20)42001672
>
>
>
> *From:* Simon Large [mailto:simon.tortoisesvn_at_gmail.com]
> *Sent:* Thursday, January 28, 2016 4:42 PM
>
> *To:* Bhide, Sukhada [CLIMATE/WR/IN]
> *Subject:* RE: Issue related to pre-commit hook
>
>
>
>
> On 28 Jan 2016 09:55, <Sukhada.Bhide_at_emerson.com> wrote:
> >
> > Below window comes when we click on commit
>
> Yes I know what the commit window looks like.
>
> > I would like user to enter following data before committing :
> >
> >
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> > 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.
> >
> >
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> >
> > For that “pre-commit-hook.py” file is there. But above message is not
> coming that is the issue.
>
> You didn't answer the question. Is this a server hook or client side? A
> server hook will only check the message you entered after you click commit.
> What you need is a client side start commit script. The subversion examples
> using svnlook are server side. They are of no use to you.
>
> Simon
> >
> > Sukhada Bhide | Desk: +91(20)42001672
> >
> >
> >
> > From: Simon Large [mailto:simon.tortoisesvn_at_gmail.com]
> > Sent: Thursday, January 28, 2016 3:20 PM
> > To: Bhide, Sukhada [CLIMATE/WR/IN]
> > Subject: RE: Issue related to pre-commit hook
> >
> >
> >
> > What are you trying to achieve with this hook? Is it running on the
> server side or is out a client hook on TortoiseSVN?
> >
> > Simon
> >
> > On 28 Jan 2016 09:39, <Sukhada.Bhide_at_emerson.com> wrote:
> >
> > 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:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > 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> 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=3157519

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2016-01-28 21:28:12 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.