You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by km...@rockwellcollins.com on 2008/07/15 18:08:10 UTC

Should start-commit hook include log message parameter?

We have implemented some pre-commit and post-commit hook scripts to 
integrate with an
internal bug tracking system.

The entered BugID is part of the commit log message.  (As setup with 
TortoiseSVN).

We validate that a BugID is valid and open in the pre-commit, but this 
could be better done
in the start-commit hook.  However, it does not get the log message as a 
parameter, and
since the transaction hasn't started you can't use svnlook like you can in 
the pre-commit.

When large transactions are performed (multiple GB), all the data has to 
be transferred
before the pre-commit hook can validate and possibly reject the BugID. 
This seems
wasteful, in both network bandwidth and user time.

Are there any technical reasons or objections why the commit log message 
can not/should not
be added as a start-commit hook parameter?

Kevin R.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Should start-commit hook include log message parameter?

Posted by Eric Gillespie <ep...@pretzelnet.org>.
Karl Fogel <kf...@red-bean.com> writes:

> However, what you say makes sense.  It might even be worth it for us to
> transmit the log message specially at the front of the commit, just to
> allow start-commit to do what you propose.  Or send the revprop values
> early, create the txn, and *then* run start-commit, giving it access to
> the unfinished txn.

It's very useful to have a hook that runs before *any* writes
happen, even creating a transaction.  Let's not lose that.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Should start-commit hook include log message parameter?

Posted by km...@rockwellcollins.com.
dglasser@gmail.com wrote on 07/16/2008 10:32:43 AM:
> On Wed, Jul 16, 2008 at 7:29 AM,  <km...@rockwellcollins.com> wrote:
> > I just thought of this, but at what point does pre-revprop-change get
> > called?  After pre-commit or before the actual txn is sent?
> >
> > It is *the place* where revprops should really be
> > validated
> 
> Actually, not as of 1.5.  In 1.5 you can set revprops with the initial
> commit, and pre-revprop-change is not invoked for these (but
> pre-commit can see it).

Guess I should have tested my theory.  (Unfortunately I've been
too busy trying to track down apache 2.2.9 ldap segmentation faults...)

I suppose this makes sense, since for newly added revprops you might/want
to need different logic.

Kevin R.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Should start-commit hook include log message parameter?

Posted by David Glasser <gl...@davidglasser.net>.
On Wed, Jul 16, 2008 at 7:29 AM,  <km...@rockwellcollins.com> wrote:
> I just thought of this, but at what point does pre-revprop-change get
> called?  After pre-commit or before the actual txn is sent?
>
> It is *the place* where revprops should really be
> validated

Actually, not as of 1.5.  In 1.5 you can set revprops with the initial
commit, and pre-revprop-change is not invoked for these (but
pre-commit can see it).

--dave

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Should start-commit hook include log message parameter?

Posted by km...@rockwellcollins.com.
dglasser@gmail.com wrote on 07/15/2008 09:37:16 PM:
> On Tue, Jul 15, 2008 at 11:50 AM, Karl Fogel <kf...@red-bean.com> 
wrote:
> > The log message is just one of many revision properties (revprops, 
i.e.,
> > unversioned properties attached to revision numbers) that might be
> > transmitted.  Specifically, it's the "svn:log" property.
> >
> > I don't think the repository has those properties yet at start-commit
> > time, because they're attached to the subversion txn that is not 
created
> > until after start-commit runs.
> 
> The "repository" on disk doesn't, but libsvn_repos sure does:
> 
>   svn_string_t *author = apr_hash_get(revprop_table, 
SVN_PROP_REVISION_AUTHOR,
>                                       APR_HASH_KEY_STRING);
>   apr_array_header_t *revprops;
> 
>   /* Run start-commit hooks. */
>   SVN_ERR(svn_repos__hooks_start_commit(repos, author ? author->data : 
NULL,
>                                         repos->client_capabilities, 
pool));
> 
> Just make svn_repos__hooks_start_commit take all of revprop_table, and
> then do something or other with it.  I'd argue that you should make it
> be something like
> 
>  REPOS AUTHOR CAPABILITIES REVPROP-NAME REVPROP-VAL REVPROP-NAME 
REVPROP-VAL ...
> 
> (leaving out svn:author from the list, perhaps)

I'd like to be consistent with other hooks (but none pass all revprop 
names/values).
pre-revprop-change gets the value as part of stdin, since I assume it is 
to
allow for large values (possibly larger than the command line length 
size).
It only has to deal with one revprop at a time though.

Anyone feel passing all the revprops in stdin as key/value pairs is wrong?

name1=value1
name2=value2
name3=value3
is multi-line and
contains embedded special '=$@!%' chars
name4=value4

Need to deal with multi-line values very carefully...


I just thought of this, but at what point does pre-revprop-change get
called?  After pre-commit or before the actual txn is sent?

It is *the place* where revprops should really be
validated, and since the commit log is just a revprop, maybe
this is a better place for me to do my BugID validation?
(The whole reason I wanted the comment in start-commit)

Kevin R.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Should start-commit hook include log message parameter?

Posted by David Glasser <gl...@davidglasser.net>.
On Tue, Jul 15, 2008 at 11:50 AM, Karl Fogel <kf...@red-bean.com> wrote:
> The log message is just one of many revision properties (revprops, i.e.,
> unversioned properties attached to revision numbers) that might be
> transmitted.  Specifically, it's the "svn:log" property.
>
> I don't think the repository has those properties yet at start-commit
> time, because they're attached to the subversion txn that is not created
> until after start-commit runs.

The "repository" on disk doesn't, but libsvn_repos sure does:

  svn_string_t *author = apr_hash_get(revprop_table, SVN_PROP_REVISION_AUTHOR,
                                      APR_HASH_KEY_STRING);
  apr_array_header_t *revprops;

  /* Run start-commit hooks. */
  SVN_ERR(svn_repos__hooks_start_commit(repos, author ? author->data : NULL,
                                        repos->client_capabilities, pool));

Just make svn_repos__hooks_start_commit take all of revprop_table, and
then do something or other with it.  I'd argue that you should make it
be something like

 REPOS AUTHOR CAPABILITIES REVPROP-NAME REVPROP-VAL REVPROP-NAME REVPROP-VAL ...

(leaving out svn:author from the list, perhaps)

--dave

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Should start-commit hook include log message parameter?

Posted by Karl Fogel <kf...@red-bean.com>.
kmradke@rockwellcollins.com writes:
> svn:author is already passed to the start-commit script, so there is
> a little precedence here.  If the svn:log message is passed to
> the start-commit script it might get a little interesting making sure
> the free-form text is passed and parsed correctly.

You could use stdin, the way pre-revprop-change and post-revprop-change
do.

> Not sure I'm real happy with creating an unfinished transaction either.
> (However, this would allow us to essentially send all the props and
>  easily add new ones in the future without adding parameters to the
>  script.)

Well, if start-commit returns non-zero, then that txn should be removed,
of course.  But I think stdin is better; part of the point of
start-commit is that it runs at the cheapest possible time.  If we
create a txn, we're going down a slippery slope.  In practical terms, we
know that author and log message are what people want, so let's offer
them, via an arg and stdin, respectively.

> pre-pre-commit? post-start-commit? :^)

I was thinking about that, but it really makes most sense to put this in
start-commit, rather than create a new hook that runs at a time that is
special only to Subversion developers.

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Should start-commit hook include log message parameter?

Posted by km...@rockwellcollins.com.
Karl Fogel <kf...@red-bean.com> wrote on 07/15/2008 01:50:49 PM:
> kmradke@rockwellcollins.com writes:
> > We have implemented some pre-commit and post-commit hook scripts to
> > integrate with an internal bug tracking system.
> >
> > The entered BugID is part of the commit log message.  (As setup with
> > TortoiseSVN).
> >
> > We validate that a BugID is valid and open in the pre-commit, but this
> > could be better done in the start-commit hook.  However, it does not
> > get the log message as a parameter, and since the transaction hasn't
> > started you can't use svnlook like you can in the pre-commit.
> >
> > When large transactions are performed (multiple GB), all the data has
> > to be transferred before the pre-commit hook can validate and possibly
> > reject the BugID.  This seems wasteful, in both network bandwidth and
> > user time.
> >
> > Are there any technical reasons or objections why the commit log
> > message can not/should not be added as a start-commit hook parameter?
> 
> The log message is just one of many revision properties (revprops, i.e.,
> unversioned properties attached to revision numbers) that might be
> transmitted.  Specifically, it's the "svn:log" property.
> 
> I don't think the repository has those properties yet at start-commit
> time, because they're attached to the subversion txn that is not created
> until after start-commit runs.
> 
> However, what you say makes sense.  It might even be worth it for us to
> transmit the log message specially at the front of the commit, just to
> allow start-commit to do what you propose.  Or send the revprop values
> early, create the txn, and *then* run start-commit, giving it access to
> the unfinished txn.
> 
> Thoughts?  Patches? :-)

I wasn't even going to *think* about a patch until someone validated my
thoughts a little.  (Thanks for that part...)

svn:author is already passed to the start-commit script, so there is
a little precedence here.  If the svn:log message is passed to
the start-commit script it might get a little interesting making sure
the free-form text is passed and parsed correctly.

Not sure I'm real happy with creating an unfinished transaction either.
(However, this would allow us to essentially send all the props and
 easily add new ones in the future without adding parameters to the
 script.)

pre-pre-commit? post-start-commit? :^)

Kevin R.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Should start-commit hook include log message parameter?

Posted by Karl Fogel <kf...@red-bean.com>.
kmradke@rockwellcollins.com writes:
> We have implemented some pre-commit and post-commit hook scripts to
> integrate with an internal bug tracking system.
>
> The entered BugID is part of the commit log message.  (As setup with
> TortoiseSVN).
>
> We validate that a BugID is valid and open in the pre-commit, but this
> could be better done in the start-commit hook.  However, it does not
> get the log message as a parameter, and since the transaction hasn't
> started you can't use svnlook like you can in the pre-commit.
>
> When large transactions are performed (multiple GB), all the data has
> to be transferred before the pre-commit hook can validate and possibly
> reject the BugID.  This seems wasteful, in both network bandwidth and
> user time.
>
> Are there any technical reasons or objections why the commit log
> message can not/should not be added as a start-commit hook parameter?

The log message is just one of many revision properties (revprops, i.e.,
unversioned properties attached to revision numbers) that might be
transmitted.  Specifically, it's the "svn:log" property.

I don't think the repository has those properties yet at start-commit
time, because they're attached to the subversion txn that is not created
until after start-commit runs.

However, what you say makes sense.  It might even be worth it for us to
transmit the log message specially at the front of the commit, just to
allow start-commit to do what you propose.  Or send the revprop values
early, create the txn, and *then* run start-commit, giving it access to
the unfinished txn.

Thoughts?  Patches? :-)

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org