You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dave Peters <ga...@yahoo.com> on 2009/05/27 18:47:29 UTC

How to force comments on SVN commit

Is there a way to force users to provide a comment when they commit?

Thanks.

-DP

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2355894

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to force comments on SVN commit

Posted by Ryan Schmidt <su...@ryandesign.com>.
On May 28, 2009, at 15:08, Dave Peters wrote:

> I got the following errors when I commit the changes:
>
> Error: Commit failed (detailed follow):
> Error: MERGE request failed on 'Support/code/Dev'
> Error: 'pre-commit' hook failed with error output
>
>
> *************************
> Here is the pre-commit file:
> !/bin/sh
>
> REPOS="$1"
> TXN="$2"
>
> SVNLOOK=/usr/bin/svnlook
>
> LOGMSG=`$SVNLOOK log -t $TXN $REPOS | grep [a-zA-Z0-9] | wc -c`
>
> if [ "$LOGMSG" -lt 5 ]; then
> echo -e Please provide a meaningful comment when committing  
> changes.. 1>&2
> exit 1
> fi
>
> commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg  
> || exit 1
>
> exit 0

Not only do you need to use the full path to svnlook as you do, but  
you also need to use the full path to any other binary or script you  
use, including grep, wc and commit-access-control.pl. Remember that  
PATH is empty while the hook script runs so it doesn't know where to  
find anything.

echo is a shell built-in so you shouldn't need to use a full path for  
that.

Also, maybe this was just a copy/paste error, but the first line of  
the script must begin with "#!" not just "!".

Finally, make sure the script is called "pre-commit" (with no  
extension) and has execute permission, for example use "chmod 755 pre- 
commit".

So:


#!/bin/sh

REPOS="$1"
TXN="$2"

SVNLOOK=/usr/bin/svnlook
GREP=/usr/bin/grep
WC=/usr/bin/wc

LOGMSG=`$SVNLOOK log -t $TXN $REPOS | $GREP [a-zA-Z0-9] | $WC -c`

if [ "$LOGMSG" -lt 5 ]; then
echo -e Please provide a meaningful comment when committing changes..  
1>&2
exit 1
fi

#commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg  
|| exit 1

exit 0

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2356605

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to force comments on SVN commit

Posted by Dave Peters <ga...@yahoo.com>.
I got the following errors when I commit the changes:

Error: Commit failed (detailed follow):
Error: MERGE request failed on 'Support/code/Dev'
Error: 'pre-commit' hook failed with error output


*************************
Here is the pre-commit file:
!/bin/sh

REPOS="$1"
TXN="$2"

SVNLOOK=/usr/bin/svnlook

LOGMSG=`$SVNLOOK log -t $TXN $REPOS | grep [a-zA-Z0-9] | wc -c`

if [ "$LOGMSG" -lt 5 ]; then
echo -e Please provide a meaningful comment when committing changes.. 1>&2
exit 1
fi

commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1

exit 0


Thanks.
-DP

--- On Wed, 5/27/09, David Weintraub <qa...@gmail.com> wrote:

> From: David Weintraub <qa...@gmail.com>
> Subject: Re: How to force comments on SVN commit
> To: "Dave Peters" <ga...@yahoo.com>
> Cc: users@subversion.tigris.org
> Date: Wednesday, May 27, 2009, 2:51 PM
> Look at "svnlook -t $TXN
> log" in your trigger. This will be the commit log
> comment. If it is blank, fail the trigger.
> 
> On Wed, May 27, 2009 at 2:47 PM,
> Dave Peters <ga...@yahoo.com>
> wrote:
> 
> Is there a way to force users to
> provide a comment when they commit?
> 
> 
> 
> Thanks.
> 
> 
> 
> -DP
> 
> 
> 
> ------------------------------------------------------
> 
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2355894
> 
> 
> 
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
> 
> 
> 
> 
> -- 
> David Weintraub
> qazwart@gmail.com
> 
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2356561

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to force comments on SVN commit

Posted by Dave Peters <ga...@yahoo.com>.
In your word, then why I got Merge error? If I disable the pre-commit, I don't have any problem to update and commit the code.

Thanks.

-DP

--- On Fri, 5/29/09, Clark S. Cox III <cl...@apple.com> wrote:

> From: Clark S. Cox III <cl...@apple.com>
> Subject: Re: How to force comments on SVN commit
> To: "Dave Peters" <ga...@yahoo.com>
> Cc: users@subversion.tigris.org
> Date: Friday, May 29, 2009, 3:51 PM
> 
> On May 29, 2009, at 12:31 PM, Dave Peters wrote:
> 
> > Thanks for the suggestion and I made the change on the
> file. However, I still got the same error.
> > 
> > Error: Commit failed (details follow):
> > Error: MERGE request failed on 'Support/code/Dev'
> > Error: 'pre-commit' hook failed with error output:
> > Error: Please provide a meaningful comment when
> committing changes.
> > 
> > Any help is appreciated.
> 
> That looks to me like your script worked exactly as it
> should have.
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357553

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

RE: How to force comments on SVN commit

Posted by Dave Peters <ga...@yahoo.com>.
Thank you so much. I'll do that. -DP



--- On Mon, 6/1/09, Bob Archer <bo...@amsi.com> wrote:

> From: Bob Archer <bo...@amsi.com>
> Subject: RE: How to force comments on SVN commit
> To: "Dave Peters" <ga...@yahoo.com>, users@subversion.tigris.org
> Date: Monday, June 1, 2009, 11:38 AM
> > > Date: Monday, June 1, 2009,
> 10:55 AM
> > > > All,
> > > >
> > > > Just want to make sure my setup for the SVN
> directory
> > > is corrected.
> > > >
> > > > #>svnadmin create /project1/repos
> > > > then Under /project1/repos/
> > > > >mkdir trunk
> > > > >mkdir branches
> > > > >mkdir tags
> > > >
> > > > Thanks again.
> > > >
> > > > --DP
> > >
> > > Um... no. You don't create the folders on the
> file system
> > > in the repository folder.
> > >
> > > BOb
> > >
> > so what should I do to create these folder: trunk,
> branches and tags?
> > 
> > Thanks.
> 
> Use the svn mkdir command. Type svn help mkdir to see how
> to do this.
> 
> BOb
> 
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357565
> 
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357588

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to force comments on SVN commit

Posted by David Weintraub <qa...@gmail.com>.
Look at "svnlook -t $TXN log" in your trigger. This will be the commit log
comment. If it is blank, fail the trigger.

On Wed, May 27, 2009 at 2:47 PM, Dave Peters <ga...@yahoo.com>wrote:

> Is there a way to force users to provide a comment when they commit?
>
> Thanks.
>
> -DP
>
> ------------------------------------------------------
>
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2355894
>
> To unsubscribe from this discussion, e-mail: [
> users-unsubscribe@subversion.tigris.org].
>



-- 
David Weintraub
qazwart@gmail.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2355899

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

RE: How to force comments on SVN commit

Posted by Bob Archer <bo...@amsi.com>.
> > Date: Monday, June 1, 2009, 10:55 AM
> > > All,
> > >
> > > Just want to make sure my setup for the SVN directory
> > is corrected.
> > >
> > > #>svnadmin create /project1/repos
> > > then Under /project1/repos/
> > > >mkdir trunk
> > > >mkdir branches
> > > >mkdir tags
> > >
> > > Thanks again.
> > >
> > > --DP
> >
> > Um... no. You don't create the folders on the file system
> > in the repository folder.
> >
> > BOb
> >
> so what should I do to create these folder: trunk, branches and tags?
> 
> Thanks.

Use the svn mkdir command. Type svn help mkdir to see how to do this.

BOb

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357565

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: How to force comments on SVN commit

Posted by David Weintraub <qa...@gmail.com>.
There are two ways you can do this:

* Checkout the root of the project and do a "svn mkdir trunk branches tags"

or

* Use the URL of the repository in the "svn mkdir" command. The advantage is
that you don't need to first do a checkout, but the disadvantage is using
the long URL name three times. For example:

$ svn co http://subversion/svn
$ svn mkdir trunk tags branches
$ svn commit -m "Making initial Subversion directories"

or

$ svn mkdir -m "Making initial Subversion directories"
http://subversion/svn/trunk http://subversion/svn/branches
http://subversion/svn/tags

Either way will work and will result in a new Repository revision with three
new sub-directories.

By the way, have you seen the Subversion book on line? <
http://svnbook.red-bean.com>


On Mon, Jun 1, 2009 at 11:30 AM, Dave Peters <ga...@yahoo.com>wrote:

> so what should I do to create these folder: trunk, branches and tags?
>
> Thanks.
>
> --DP
>
> --- On Mon, 6/1/09, Bob Archer <Bo...@amsi.com> wrote:
>
> > From: Bob Archer <Bo...@amsi.com>
> > Subject: RE: How to force comments on SVN commit
> > To: "Dave Peters" <ga...@yahoo.com>, "
> users@subversion.tigris.org" <us...@subversion.tigris.org>
> > Date: Monday, June 1, 2009, 10:55 AM
> > > All,
> > >
> > > Just want to make sure my setup for the SVN directory
> > is corrected.
> > >
> > > #>svnadmin create /project1/repos
> > > then Under /project1/repos/
> > > >mkdir trunk
> > > >mkdir branches
> > > >mkdir tags
> > >
> > > Thanks again.
> > >
> > > --DP
> >
> > Um... no. You don't create the folders on the file system
> > in the repository folder.
> >
> > BOb
> >
>
> ------------------------------------------------------
>
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357564
>
> To unsubscribe from this discussion, e-mail: [
> users-unsubscribe@subversion.tigris.org].
>



-- 
David Weintraub
qazwart@gmail.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357710

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

RE: How to force comments on SVN commit

Posted by Dave Peters <ga...@yahoo.com>.
so what should I do to create these folder: trunk, branches and tags?

Thanks.

--DP

--- On Mon, 6/1/09, Bob Archer <Bo...@amsi.com> wrote:

> From: Bob Archer <Bo...@amsi.com>
> Subject: RE: How to force comments on SVN commit
> To: "Dave Peters" <ga...@yahoo.com>, "users@subversion.tigris.org" <us...@subversion.tigris.org>
> Date: Monday, June 1, 2009, 10:55 AM
> > All,
> > 
> > Just want to make sure my setup for the SVN directory
> is corrected.
> > 
> > #>svnadmin create /project1/repos
> > then Under /project1/repos/
> > >mkdir trunk
> > >mkdir branches
> > >mkdir tags
> > 
> > Thanks again.
> > 
> > --DP
> 
> Um... no. You don't create the folders on the file system
> in the repository folder.
> 
> BOb
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357564

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

RE: How to force comments on SVN commit

Posted by Bob Archer <bo...@amsi.com>.
> All,
> 
> Just want to make sure my setup for the SVN directory is corrected.
> 
> #>svnadmin create /project1/repos
> then Under /project1/repos/
> >mkdir trunk
> >mkdir branches
> >mkdir tags
> 
> Thanks again.
> 
> --DP

Um... no. You don't create the folders on the file system in the repository folder.

BOb

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357556

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: How to force comments on SVN commit

Posted by Dave Peters <ga...@yahoo.com>.
All,

Just want to make sure my setup for the SVN directory is corrected.

#>svnadmin create /project1/repos
then Under /project1/repos/
>mkdir trunk
>mkdir branches
>mkdir tags

Thanks again.

--DP



--- On Mon, 6/1/09, Dave Peters <ga...@yahoo.com> wrote:

> From: Dave Peters <ga...@yahoo.com>
> Subject: Re: How to force comments on SVN commit
> To: "Clark S. Cox III" <cl...@apple.com>
> Cc: users@subversion.tigris.org
> Date: Monday, June 1, 2009, 10:46 AM
> In your word, then why I got Merge
> error? If I disable the pre-commit, I don't have any problem
> to update and commit the code.
> 
> Thanks.
> 
> -DP
> 
> --- On Fri, 5/29/09, Clark S. Cox III <cl...@apple.com>
> wrote:
> 
> > From: Clark S. Cox III <cl...@apple.com>
> > Subject: Re: How to force comments on SVN commit
> > To: "Dave Peters" <ga...@yahoo.com>
> > Cc: users@subversion.tigris.org
> > Date: Friday, May 29, 2009, 3:51 PM
> > 
> > On May 29, 2009, at 12:31 PM, Dave Peters wrote:
> > 
> > > Thanks for the suggestion and I made the change
> on the
> > file. However, I still got the same error.
> > > 
> > > Error: Commit failed (details follow):
> > > Error: MERGE request failed on
> 'Support/code/Dev'
> > > Error: 'pre-commit' hook failed with error
> output:
> > > Error: Please provide a meaningful comment when
> > committing changes.
> > > 
> > > Any help is appreciated.
> > 
> > That looks to me like your script worked exactly as
> it
> > should have.
> >
> 
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357553
> 
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357555

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

RE: How to force comments on SVN commit

Posted by Dave Peters <ga...@yahoo.com>.
Thank you so much. I'll do that. -DP



--- On Mon, 6/1/09, Bob Archer <bo...@amsi.com> wrote:

> From: Bob Archer <bo...@amsi.com>
> Subject: RE: How to force comments on SVN commit
> To: "Dave Peters" <ga...@yahoo.com>, users@subversion.tigris.org
> Date: Monday, June 1, 2009, 11:38 AM
> > > Date: Monday, June 1, 2009,
> 10:55 AM
> > > > All,
> > > >
> > > > Just want to make sure my setup for the SVN
> directory
> > > is corrected.
> > > >
> > > > #>svnadmin create /project1/repos
> > > > then Under /project1/repos/
> > > > >mkdir trunk
> > > > >mkdir branches
> > > > >mkdir tags
> > > >
> > > > Thanks again.
> > > >
> > > > --DP
> > >
> > > Um... no. You don't create the folders on the
> file system
> > > in the repository folder.
> > >
> > > BOb
> > >
> > so what should I do to create these folder: trunk,
> branches and tags?
> > 
> > Thanks.
> 
> Use the svn mkdir command. Type svn help mkdir to see how
> to do this.
> 
> BOb
> 
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357565
> 
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2357587

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to force comments on SVN commit

Posted by "Clark S. Cox III" <cl...@apple.com>.
On May 29, 2009, at 12:31 PM, Dave Peters wrote:

> Thanks for the suggestion and I made the change on the file.  
> However, I still got the same error.
>
> Error: Commit failed (details follow):
> Error: MERGE request failed on 'Support/code/Dev'
> Error: 'pre-commit' hook failed with error output:
> Error: Please provide a meaningful comment when committing changes.
>
> Any help is appreciated.

That looks to me like your script worked exactly as it should have.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2356943

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: How to force comments on SVN commit

Posted by Ryan Schmidt <su...@ryandesign.com>.
On May 29, 2009, at 14:31, Dave Peters wrote:

> Thanks for the suggestion and I made the change on the file.  
> However, I still got the same error.
>
> Error: Commit failed (details follow):
> Error: MERGE request failed on 'Support/code/Dev'
> Error: 'pre-commit' hook failed with error output:
> Error: Please provide a meaningful comment when committing changes.

No, before you were getting the error

> Error: 'pre-commit' hook failed with error output

followed by nothing, indicating your hook was having a problem before  
outputting the error message the hook was designed to output. But now  
you are getting that message followed by the error message you wanted  
your hook to show. So it now seems to be working correctly.

What log message did you in fact supply in your commit command?  
Should it be passing the restrictions your new hook puts in place?

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2356942

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

RE: How to force comments on SVN commit

Posted by Bob Archer <bo...@amsi.com>.
> Thanks for the suggestion and I made the change on the file. However, I
> still got the same error.
> 
> Error: Commit failed (details follow):
> Error: MERGE request failed on 'Support/code/Dev'
> Error: 'pre-commit' hook failed with error output:
> Error: Please provide a meaningful comment when committing changes.

I'm confused. Isn't this what you wanted? You attempted a commit without setting a message... the trigged returned and error message that you need to create a meaningful comment.

What are you expecting to see?

BOb

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2356938

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: How to force comments on SVN commit

Posted by Dave Peters <ga...@yahoo.com>.
Thanks for the suggestion and I made the change on the file. However, I still got the same error.

Error: Commit failed (details follow):
Error: MERGE request failed on 'Support/code/Dev'
Error: 'pre-commit' hook failed with error output:
Error: Please provide a meaningful comment when committing changes.

Any help is appreciated.

Thanks. --DP



Here is the file
#!/bin/sh

REPOS="$1"
TXN="$2"

SVNLOOK=/usr/bin/svnlook
GREP=/bin/grep
WC=/usr/bin/wc

LOGMSG=`$SVNLOOK log -t $TXN $REPOS | $GREP [a-zA-Z0-9] | $WC -c`

if [ "$LOGMSG" -lt 5 ]; then
echo -e Please provide a meaningful comment when committing changes.. 1>&2
exit 1
fi

#/hooks/commit-access-control.pl "$REPOS" "$TXN" /hooks/commit-access-control.cfg || exit 1

exit 0


--- On Thu, 5/28/09, Ryan Schmidt <su...@ryandesign.com> wrote:

> From: Ryan Schmidt <su...@ryandesign.com>
> Subject: Re: How to force comments on SVN commit
> To: "Dave Peters" <ga...@yahoo.com>
> Cc: "David Weintraub" <qa...@gmail.com>, users@subversion.tigris.org
> Date: Thursday, May 28, 2009, 6:32 PM
> On May 28, 2009, at 15:08, Dave
> Peters wrote:
> 
> > I got the following errors when I commit the changes:
> >
> > Error: Commit failed (detailed follow):
> > Error: MERGE request failed on 'Support/code/Dev'
> > Error: 'pre-commit' hook failed with error output
> >
> >
> > *************************
> > Here is the pre-commit file:
> > !/bin/sh
> >
> > REPOS="$1"
> > TXN="$2"
> >
> > SVNLOOK=/usr/bin/svnlook
> >
> > LOGMSG=`$SVNLOOK log -t $TXN $REPOS | grep [a-zA-Z0-9]
> | wc -c`
> >
> > if [ "$LOGMSG" -lt 5 ]; then
> > echo -e Please provide a meaningful comment when
> committing  
> > changes.. 1>&2
> > exit 1
> > fi
> >
> > commit-access-control.pl "$REPOS" "$TXN"
> commit-access-control.cfg  
> > || exit 1
> >
> > exit 0
> 
> Not only do you need to use the full path to svnlook as you
> do, but  
> you also need to use the full path to any other binary or
> script you  
> use, including grep, wc and commit-access-control.pl.
> Remember that  
> PATH is empty while the hook script runs so it doesn't know
> where to  
> find anything.
> 
> echo is a shell built-in so you shouldn't need to use a
> full path for  
> that.
> 
> Also, maybe this was just a copy/paste error, but the first
> line of  
> the script must begin with "#!" not just "!".
> 
> Finally, make sure the script is called "pre-commit" (with
> no  
> extension) and has execute permission, for example use
> "chmod 755 pre- 
> commit".
> 
> So:
> 
> 
> #!/bin/sh
> 
> REPOS="$1"
> TXN="$2"
> 
> SVNLOOK=/usr/bin/svnlook
> GREP=/usr/bin/grep
> WC=/usr/bin/wc
> 
> LOGMSG=`$SVNLOOK log -t $TXN $REPOS | $GREP [a-zA-Z0-9] |
> $WC -c`
> 
> if [ "$LOGMSG" -lt 5 ]; then
> echo -e Please provide a meaningful comment when committing
> changes..  
> 1>&2
> exit 1
> fi
> 
> #commit-access-control.pl "$REPOS" "$TXN"
> commit-access-control.cfg  
> || exit 1
> 
> exit 0
> 
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2356605
> 
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2356936

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].