You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Janek Kozicki <ja...@wp.pl> on 2008/08/22 06:54:13 UTC
pre-commit hook newbie: enforcing ChangeLog updates
Hi,
I would like to learn about pre-commit hooks in SVN. And first thing
that I would like to do is following:
- Check if this commit modifies /trunk/ChangeLog
- if yes: let it happen
- if no:
- Check how many commits ago this user modified /trunk/ChangeLog
(counting only commits of this user, and skipping all other
users who did commits in between)
- if less than 5: let it happen
- if more than 5: return "Error, it is your 5th commit
without updating ChangLog, please update it". FAILURE
Can anybody direct me to, what are the necessary SVN tools to do that?
- checking if /trunk/ChangeLog is being modified
- checking how long time ago THIS user modified /trunk/ChangeLog
Also: is it possible to write those pre-commit hooks in bash? I don't
know perl or python, but I'm quite proficient with bash.
best regards
--
Janek Kozicki |
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: pre-commit hook newbie: enforcing ChangeLog updates
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Aug 22, 2008, at 01:54, Janek Kozicki wrote:
> I would like to learn about pre-commit hooks in SVN. And first thing
> that I would like to do is following:
>
> - Check if this commit modifies /trunk/ChangeLog
>
> - if yes: let it happen
>
> - if no:
> - Check how many commits ago this user modified /trunk/
> ChangeLog
> (counting only commits of this user, and skipping all other
> users who did commits in between)
>
> - if less than 5: let it happen
>
> - if more than 5: return "Error, it is your 5th commit
> without updating ChangLog, please update it". FAILURE
>
>
> Can anybody direct me to, what are the necessary SVN tools to do that?
>
> - checking if /trunk/ChangeLog is being modified
Consult the output of "svnlook changed -t $TXN $REPOS" and see if
trunk/ChangeLog is listed.
> - checking how long time ago THIS user modified /trunk/ChangeLog
Subversion doesn't have a command that directly answers that
question, so you'll have to parse the output of "svn log" to get it.
> Also: is it possible to write those pre-commit hooks in bash? I don't
> know perl or python, but I'm quite proficient with bash.
Sure. Just make the first line of the pre-commit hook "#!/bin/bash".
And of course set its execute bit.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: pre-commit hook newbie: enforcing ChangeLog updates
Posted by Jon Gorrono <jp...@ucdavis.edu>.
A very useful trick is to require a bug track key... for us it is a
JIRA key like 'SAK-xxxx' and FAIL in a pre-commit if it is absent....
*or* if the much-discouraged 'NOJIRA' flag is absent in the comment.
We use this to build change logs by parsing the xml output from svn
log --xml for these keys and spitting out Confluence wiki markup
You can see an example from our last vendor drop here:
https://confluence.ucdavis.edu/confluence/x/jAGq
On Fri, Aug 22, 2008 at 10:52 AM, Janek Kozicki <ja...@wp.pl> wrote:
> Ryan Schmidt said: (by the date of Fri, 22 Aug 2008 12:16:36 -0500)
>
>> If you just want to keep track of what others in your team are
>> committing -- and that's a good thing to be keeping track of -- it's
>> useful to set up a commit mailing list, to which an automated email
>> is sent after every commit, with the diff of the commit. This way
>> changes can be reviewed and critiqued immediately.
>
> yes, we already have that. Useful for grepping diffs also. But not
> enough :) The code is too big. A short summary in a ChangeLog will be
> more useful.
>
> --
> Janek Kozicki |
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>
--
Jon Gorrono
email{>+++++++++[>+++++++++++>++++++++++++>+++++++>+++++<<<<-]>+++++++.>++++.<---.>-.+++..---.-.+.>+.<++++++.<----.+.---.>+.<++++++++.>---.>>+.<<<----.-.>++.}
http{ats.ucdavis.edu}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: pre-commit hook newbie: enforcing ChangeLog updates
Posted by Janek Kozicki <ja...@wp.pl>.
Ryan Schmidt said: (by the date of Fri, 22 Aug 2008 12:16:36 -0500)
> If you just want to keep track of what others in your team are
> committing -- and that's a good thing to be keeping track of -- it's
> useful to set up a commit mailing list, to which an automated email
> is sent after every commit, with the diff of the commit. This way
> changes can be reviewed and critiqued immediately.
yes, we already have that. Useful for grepping diffs also. But not
enough :) The code is too big. A short summary in a ChangeLog will be
more useful.
--
Janek Kozicki |
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: pre-commit hook newbie: enforcing ChangeLog updates
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Aug 22, 2008, at 11:40, Janek Kozicki wrote:
> Quinn Taylor said: (by the date of Fri, 22 Aug 2008 07:27:02
> -0600)
>
>> I can at least understand the
>> desire to require that this be updated to avoid having someone dig
>> through the logs and summarize what has changed right before a
>> release.
>
> this is exactly the case. I had to dig through 200 svn log entries
> and filter out the most important stuff for "release news".
>
> Perhaps I will set the ChangeLog update limit to 10 or 20 commits. So
> those 200 svn log entries would be summarized in 10 or 20 ChangeLog
> entries. From those entries it would be much easier for me to prepare
> "release news". And also I will learn about what important others
> have done :)
If you just want to keep track of what others in your team are
committing -- and that's a good thing to be keeping track of -- it's
useful to set up a commit mailing list, to which an automated email
is sent after every commit, with the diff of the commit. This way
changes can be reviewed and critiqued immediately.
> Also it has to be on per-user basis, because each person in the team
> is working on separate parts of the code and they know the best what
> they have done.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: pre-commit hook newbie: enforcing ChangeLog updates
Posted by Janek Kozicki <ja...@wp.pl>.
Quinn Taylor said: (by the date of Fri, 22 Aug 2008 07:27:02 -0600)
> I can at least understand the
> desire to require that this be updated to avoid having someone dig
> through the logs and summarize what has changed right before a
> release.
this is exactly the case. I had to dig through 200 svn log entries
and filter out the most important stuff for "release news".
Perhaps I will set the ChangeLog update limit to 10 or 20 commits. So
those 200 svn log entries would be summarized in 10 or 20 ChangeLog
entries. From those entries it would be much easier for me to prepare
"release news". And also I will learn about what important others
have done :)
Also it has to be on per-user basis, because each person in the team
is working on separate parts of the code and they know the best what
they have done.
thanks!
--
Janek Kozicki |
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: pre-commit hook newbie: enforcing ChangeLog updates
Posted by Quinn Taylor <qu...@mac.com>.
>> Hi,
>>
>> I would like to learn about pre-commit hooks in SVN. And first thing
>> that I would like to do is following:
>>
>> - Check if this commit modifies /trunk/ChangeLog
>>
>> - if yes: let it happen
>>
>> - if no:
>> - Check how many commits ago this user modified /trunk/ChangeLog
>> (counting only commits of this user, and skipping all other
>> users who did commits in between)
>>
>> - if less than 5: let it happen
>>
>> - if more than 5: return "Error, it is your 5th commit
>> without updating ChangLog, please update it". FAILURE
>>
>>
>> Can anybody direct me to, what are the necessary SVN tools to do
>> that?
>
> Are you saying that you have a ChangeLog file which you maintain
> inside the repository? Isn't that redundant (and extra effort/time for
> your developers) when you could and should already have all that
> information in the logs themselves?
It depends on the intent of the ChangeLog. For example, many software
programs have a change history which the user can examine, but it is
in terms of releases (i.e. tags) rather than revisions, and generally
not associated with developer usernames. I can at least understand the
desire to require that this be updated to avoid having someone dig
through the logs and summarize what has changed right before a
release. Depending on the log messages committed by developers, one
can imagine that the information in the SVN history and the ChangeLog
file ca be quite different. However, if they do contain the same
information, I'm with you—just use Subversion's history to track
changes.
- Quinn
Re: pre-commit hook newbie: enforcing ChangeLog updates
Posted by Andy Levy <an...@gmail.com>.
On Fri, Aug 22, 2008 at 02:54, Janek Kozicki <ja...@wp.pl> wrote:
> Hi,
>
> I would like to learn about pre-commit hooks in SVN. And first thing
> that I would like to do is following:
>
> - Check if this commit modifies /trunk/ChangeLog
>
> - if yes: let it happen
>
> - if no:
> - Check how many commits ago this user modified /trunk/ChangeLog
> (counting only commits of this user, and skipping all other
> users who did commits in between)
>
> - if less than 5: let it happen
>
> - if more than 5: return "Error, it is your 5th commit
> without updating ChangLog, please update it". FAILURE
>
>
> Can anybody direct me to, what are the necessary SVN tools to do that?
Are you saying that you have a ChangeLog file which you maintain
inside the repository? Isn't that redundant (and extra effort/time for
your developers) when you could and should already have all that
information in the logs themselves?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org