You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2003/03/14 03:36:08 UTC

revprop change notifications (was: svn commit: rev 5289 ...)

On Wed, Mar 12, 2003 at 07:28:29PM -0600, cmpilato@collab.net wrote:
> Karl Fogel <kf...@newton.ch.collab.net> writes:
> > Greg Stein <gs...@lyra.org> writes:
> > > Can you start using the client to make these changes? Using the CGI script
> > > means that the hook script doesn't run, which means that the mailing list
> > > won't get notifications of the change.
> > > 
> > > I'd even go so far as to state that the CGI should be removed.
> > 
> > If the client method showed *diffs*, then yes.  But right now, it just
> > shows the new propval in its entirety, and you can't tell what changed.
> > 
> > I frankly find those mails useless.  Does anyone find them useful?
> 
> Unfortunately, I'm afraid Karl is right.  The mails are useful in that
> some notification of an event occurs, but generally my memory isn't
> precise enough to recall the pre- version of the property value well
> enough to infer a diff.

"some notification of an event" ... that is a lot more than the CGI
provides. We at least *know* the log message was changed. And I've gone back
to previous commit emails to see what the change was. Not ideal, certainly.

I thought the original idea was that the previous content would be given to
the script on stdin, but that we just hadn't implemented that yet. We could
also provide the new content to the pre- hook in case it wanted to perform a
check on the contents before allowing it (e.g. validate the format/schema of
the property).

(a tempfile won't work since it has to have a unique name, and there is no
 way to transmit that name to the post-change)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by cm...@collab.net.
cmpilato@collab.net writes:

> > There is some argument for using a tempfile for the post-revprop
> > hook, but that also opens up the whole "What happens if no one
> > cleans up the file?" question, as well as unintuitively involving
> > two hook scripts in what most people would imagine is a
> > one-hook-script problem.
> 
> No, actually, it doesn't open that question.  The repos layer is
> required to clean up that file.  How hard is that?
> 
> > IMHO, stdin is a *much* cleaner solution; I'm implementing it now.
> 
> STDIN is also much more limited; please reconsider.

You know what?  Never mind.  If a script wants to be able to have
random access on the property value, *it* can write the thing to a
tempfile and worry about the cleanup.

Go forth in STDINity, my son!

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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
cmpilato@collab.net writes:
> No, actually, it doesn't open that question.  The repos layer is
> required to clean up that file.  How hard is that?

Oh, I think I see -- so the overall idea here is that
pre-revprop-change wouldn't be involved at all; rather, the function
that drives the post-revprop hook would

   1. write the old value to a tmpfile somewhere

   2. invoke the post-revprop hook, passing the tempfile name as an
      argument

   3. clean up the tempfile after the post-revprop change exits

Is that what you have in mind?

> STDIN is also much more limited; please reconsider.

Sure, consider it reconsidered.  (How is stdin limited, exactly?)

Actually, some of the change is the same no matter what, so I'll
commit that part while we figure out which way to go.

-Karl

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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by cm...@collab.net.
Greg Hudson <gh...@MIT.EDU> writes:

> On Fri, 2003-03-14 at 00:24, cmpilato@collab.net wrote:
> > > IMHO, stdin is a *much* cleaner solution; I'm implementing it now.
> > 
> > STDIN is also much more limited; please reconsider.
> 
> Do you have use cases in mind for the added flexibility of a file?

I did; even said as much in a previous mail, and then I remembered ...

> (And, on modern platforms, the "mktemp" command makes it pretty trivial
> for a shell script to write out stdin to a temporary file.)

... yeah, I remembered something like that. :-)



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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by Greg Hudson <gh...@MIT.EDU>.
On Fri, 2003-03-14 at 00:24, cmpilato@collab.net wrote:
> > IMHO, stdin is a *much* cleaner solution; I'm implementing it now.
> 
> STDIN is also much more limited; please reconsider.

Do you have use cases in mind for the added flexibility of a file?

(And, on modern platforms, the "mktemp" command makes it pretty trivial
for a shell script to write out stdin to a temporary file.)


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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by cm...@collab.net.
Karl Fogel <kf...@newton.ch.collab.net> writes:

> There's no reason for the pre-revprop hook to take the value as a
> tempfile -- it can get the value from the Subversion txn as many times
> as it wants.

True, true.  I thought we were taking it on STDIN, since that's what
the pre-revprop-change hook template claims >:-(.

> There is some argument for using a tempfile for the post-revprop
> hook, but that also opens up the whole "What happens if no one
> cleans up the file?" question, as well as unintuitively involving
> two hook scripts in what most people would imagine is a
> one-hook-script problem.

No, actually, it doesn't open that question.  The repos layer is
required to clean up that file.  How hard is that?

> IMHO, stdin is a *much* cleaner solution; I'm implementing it now.

STDIN is also much more limited; please reconsider.

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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
cmpilato@collab.net writes:
> Hm...the more I think about it, the more I prefer the tempfile thing.
> By using a tempfile, we give scripts the ability to read
> non-streamily, or to read the value more than once.  This might
> initially sound like a bad thing, but consider a script which must
> first example the property to determine if it is binary or not, and
> might choose a different 'diff' program based on the results.
> 
> In fact, if we change the pre-revprop-change hook to also take the
> tempfile, then we can now write the old property value only once --
> and post pre- and post- hooks can read from the same file.  Might as
> well make the new property value live in a tempfile, too.
> 
> Whatever, hands are running faster than my mind right now, so perhaps
> this is all rubbish.

I think you might be onto something at the end, there...

  <ducks>

There's no reason for the pre-revprop hook to take the value as a
tempfile -- it can get the value from the Subversion txn as many times
as it wants.  There is some argument for using a tempfile for the
post-revprop hook, but that also opens up the whole "What happens if
no one cleans up the file?" question, as well as unintuitively
involving two hook scripts in what most people would imagine is a
one-hook-script problem.  Yick.

IMHO, stdin is a *much* cleaner solution; I'm implementing it now.

-Karl

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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by cm...@collab.net.
Greg Stein <gs...@lyra.org> writes:

> That would work, as long as SVN was doing it. I was thinking about the case
> where the pre- creates a tempfile, hoping that the post- would read it.
> 
> I hope that we wouldn't have to use a tempfile, but we might have to, to
> deal properly with binary properties. Some shells/scripting languages might
> not deal very well with binary on stdin.

Hm...the more I think about it, the more I prefer the tempfile thing.
By using a tempfile, we give scripts the ability to read
non-streamily, or to read the value more than once.  This might
initially sound like a bad thing, but consider a script which must
first example the property to determine if it is binary or not, and
might choose a different 'diff' program based on the results.

In fact, if we change the pre-revprop-change hook to also take the
tempfile, then we can now write the old property value only once --
and post pre- and post- hooks can read from the same file.  Might as
well make the new property value live in a tempfile, too.

Whatever, hands are running faster than my mind right now, so perhaps
this is all rubbish.

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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by Greg Stein <gs...@lyra.org>.
On Thu, Mar 13, 2003 at 10:16:35PM -0600, cmpilato@collab.net wrote:
>...
> I know we weren't planning to use a tempfile, but why exactly would
> this not work, again?  
> 
>     tmp_dir = (the not yet existent)apr_dir_temp_get();
>     path = svn_io_open_unique_file(tmp_dir, "svn-ps", "tmp")
>     write(path, old_value)
> 
> Pass PATH to the post-revprop-change hook as a cmd-line arg (with
> REPOS, PROPNAME, etc).  The hook reads from PATH, does its thing, and
> then the repos layer unlinks PATH.

That would work, as long as SVN was doing it. I was thinking about the case
where the pre- creates a tempfile, hoping that the post- would read it.

I hope that we wouldn't have to use a tempfile, but we might have to, to
deal properly with binary properties. Some shells/scripting languages might
not deal very well with binary on stdin.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

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

Re: revprop change notifications (was: svn commit: rev 5289 ...)

Posted by cm...@collab.net.
Greg Stein <gs...@lyra.org> writes:

> I thought the original idea was that the previous content would be given to
> the script on stdin, but that we just hadn't implemented that yet. We could
> also provide the new content to the pre- hook in case it wanted to perform a
> check on the contents before allowing it (e.g. validate the format/schema of
> the property).

That was indeed the plan.

> (a tempfile won't work since it has to have a unique name, and there is no
>  way to transmit that name to the post-change)

?

I know we weren't planning to use a tempfile, but why exactly would
this not work, again?  

    tmp_dir = (the not yet existent)apr_dir_temp_get();
    path = svn_io_open_unique_file(tmp_dir, "svn-ps", "tmp")
    write(path, old_value)

Pass PATH to the post-revprop-change hook as a cmd-line arg (with
REPOS, PROPNAME, etc).  The hook reads from PATH, does its thing, and
then the repos layer unlinks PATH.

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