You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by rb...@connected.com on 2003/11/20 20:38:13 UTC

force commit comments

What is the best way to force users to provide a comment when they commit?

Thanks,
Ryan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connected: the leading provider of automated 
data protection, archiving and recovery 
solutions for distributed data.
http://www.connected.com

 

Re: force commit comments

Posted by kf...@collab.net.
Julian Foad <ju...@btopenworld.com> writes:
> Education, probably.  If they are leaving it blank because they
> don't perceive a benefit in going to the extra effort of writing a
> proper log message, and then you mechanically force them to put
> something in the message, then they will probably start writing "."
> or "Updated" as their log message. :-)

Excellent point -- just for some real-world confirmation, I've seen
this happen more times than I can count (and I can count pretty high!).

:-)

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

Re: force commit comments

Posted by Julian Foad <ju...@btopenworld.com>.
rbraswell@connected.com wrote:
> 
> What is the best way to force users to provide a comment when they commit?

Education, probably.  If they are leaving it blank because they don't perceive a benefit in going to the extra effort of writing a proper log message, and then you mechanically force them to put something in the message, then they will probably start writing "." or "Updated" as their log message. :-)

- Julian


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

Re: force commit comments

Posted by Juanma Barranquero <le...@terra.es>.
"C. Michael Pilato" <cm...@collab.net> wrote:

> kfogel@collab.net writes:
> > Perhaps we should change this.
> That's correct.  Sounds safe enough to me.

Great.

Thanks,

                                                           /L/e/k/t/u


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

Re: force commit comments

Posted by Juanma Barranquero <le...@terra.es>.
On 23 Nov 2003 12:07:07 -0600, "C. Michael Pilato" <cm...@collab.net> wrote:

> Python SWIG bindings, baby.  That's all I gotta say about that.

Thanks. This is a time when I'm just happy to be proven wrong :)

                                                           /L/e/k/t/u


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

Re: force commit comments

Posted by "C. Michael Pilato" <cm...@collab.net>.
Juanma Barranquero <le...@terra.es> writes:

> On 23 Nov 2003 00:26:17 -0600, "C. Michael Pilato" <cm...@collab.net> wrote:
> 
> > If I'm not mistaken, Subversion itself has never disallowed this.  So,
> > the message just needs to be tweaked a bit.
> 
> OTOH, I don't know how to do which I intended, other than as I
> previously suggested (via post-commit).

Python SWIG bindings, baby.  That's all I gotta say about that.

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

Re: force commit comments

Posted by Juanma Barranquero <le...@terra.es>.
On 23 Nov 2003 00:26:17 -0600, "C. Michael Pilato" <cm...@collab.net> wrote:

> If I'm not mistaken, Subversion itself has never disallowed this.  So,
> the message just needs to be tweaked a bit.

OTOH, I don't know how to do which I intended, other than as I
previously suggested (via post-commit).

The reason is that pre-commit receives the arguments REPOS-NAME and
TXN-NAME, which can be used with "svnlook propget" to get svn:log; but
to modify the log message, the only way is via "svnadmin setlog" (or
"svn propset"), which do not understand txn names, only revision numbers...

So, unless I'm mistaken, if modification of revision properties in
pre-commit is to be valid, some support should be added (some way to
filter the property data, perhaps).

Related: why does "svnadmin setlog" only accept the log message as a
file:

  setlog: usage: svnadmin setlog REPOS_PATH -r REVISION FILE

while "svn propset" also admits passing the log as an argument

  2. propset PROPNAME --revprop -r REV [PROPVAL | -F VALFILE] [URL]

which is sometimes much more convenient? (In my case, it would eliminate
the need for a uniquely-named temporary file, for example).

Thanks,

                                                           /L/e/k/t/u


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

Re: force commit comments

Posted by "C. Michael Pilato" <cm...@collab.net>.
Juanma Barranquero <le...@terra.es> writes:

> > > Perhaps we should change this.  Modifying the log message (or other
> > > revision properties) seems harmless enough [snip]
> >
> > That's correct.  Sounds safe enough to me.
> 
> BTW, does that mean "We should change SVN to allow this", or "We should
> change the message, because in fact modifying the revision properties is
> already safe"? :-)

If I'm not mistaken, Subversion itself has never disallowed this.  So,
the message just needs to be tweaked a bit.

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

Re: force commit comments

Posted by Juanma Barranquero <le...@terra.es>.
> > Perhaps we should change this.  Modifying the log message (or other
> > revision properties) seems harmless enough [snip]
>
> That's correct.  Sounds safe enough to me.

BTW, does that mean "We should change SVN to allow this", or "We should
change the message, because in fact modifying the revision properties is
already safe"? :-)

                                                           /L/e/k/t/u


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

Re: force commit comments

Posted by "C. Michael Pilato" <cm...@collab.net>.
kfogel@collab.net writes:

> Juanma Barranquero <jm...@laley.wke.es> writes:
> > AFAICS, hooks/pre-commit.tmpl says, very prominently:
> > 
> >    #   ***   NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN.    ***
> > 
> > so I'm assuming the only way is to have a post-commit hook which does
> 
> Perhaps we should change this.  Modifying the log message (or other
> revision properties) seems harmless enough, because there's no working
> copy state corresponding to it.  Modifying the versioned stuff is
> what's dangerous.

That's correct.  Sounds safe enough to me.

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

Re: force commit comments

Posted by kf...@collab.net.
Juanma Barranquero <jm...@laley.wke.es> writes:
> AFAICS, hooks/pre-commit.tmpl says, very prominently:
> 
>    #   ***   NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN.    ***
> 
> so I'm assuming the only way is to have a post-commit hook which does

Perhaps we should change this.  Modifying the log message (or other
revision properties) seems harmless enough, because there's no working
copy state corresponding to it.  Modifying the versioned stuff is
what's dangerous.

-Karl

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

Re: force commit comments

Posted by Juanma Barranquero <jm...@laley.wke.es>.
> Create a pre-commit hook that checks the value of the 'svn:log' property
> on the pending transaction.  In fact, I think that's the example we use
> in the template for pre-commit hooks!

I have a related question: what's the best way to modify a log at
committing? (In my specific case, I want to be sure it doesn't end in \n,
for purely aesthetic reasons).

AFAICS, hooks/pre-commit.tmpl says, very prominently:

   #   ***   NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN.    ***

so I'm assuming the only way is to have a post-commit hook which does
(warning: Windows syntax ahead) something like:

 svnlook log %1 -r %2 | perl -0ne "chomp; print $_" > %TEMP%\file 
 svnadmin setlog %1 -r %2 %TEMP%\file
 del %TEMP%\file

which, leaving aside the issue of the possible race condition for the
file**, strikes me as odd: instead of modifying the log at arrival
(during pre-commit time, I mean), we have to wait for it to be written
to SVN, then read it, write it to a file, and then read back and pasted
into SVN again... 

**Obviously, there can be no guarantee that hook processing for txn N is
finished before hook processing for txn N+1 starts, because hooks can
launch *anything* :(, so I'll have to delve into the delightful issue of
temporary-file management under CMD.EXE <sigh>.

---------------------------------------------------------
      ^^^^^^^^^^
On a (physically :) separate note, also related to hooks (though it is
perhaps a question for dev@): (pre|post)-revprop-change.tmpl says that
it receives four arguments, and when you're using authenticated users,
it is so.

But if you set your Apache so the /svn location needs no user validation
(and, consequently, all commits are anonymous), *-revprop-change hooks
receive three arguments. Not four, with 3rd (USERNAME) empty, but three.
I tested with compiled programs (because I feared that an empty argument
could be causing trouble for the .BAT script), and argc was 3.

IMHO, either a 3rd, empty, argument should be passed when there's no
username, or at least the comments in the .tmpl hooks should be ammended...

Thanks,

                                                                Juanma



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

Re: force commit comments

Posted by Vincent Lefevre <vi...@vinc17.org>.
I have a few questions...

On 2003-11-20 14:43:25 -0600, Ben Collins-Sussman wrote:
> SVNLOOK=/usr/local/bin/svnlook

Why using a full path, that may not be correct on all systems?
Isn't SVNLOOK=svnlook a better idea?

> LOG=`$SVNLOOK log -t "$TXN" "$REPOS"`
> echo "$LOG" | grep "[a-zA-Z0-9]" > /dev/null || exit 1

Why not

$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" > /dev/null || exit 1

?

Is the > /dev/null really necessary (the /dev/null redirection should
be done by subversion IMHO)? And what about stderr (fd 2)?

-- 
Vincent Lefèvre <vi...@vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

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

Re: force commit comments

Posted by Ben Collins-Sussman <su...@collab.net>.
On Thu, 2003-11-20 at 14:38, rbraswell@connected.com wrote:
> What is the best way to force users to provide a comment when they
> commit?

Create a pre-commit hook that checks the value of the 'svn:log' property
on the pending transaction.  In fact, I think that's the example we use
in the template for pre-commit hooks!

Yup:


REPOS="$1"
TXN="$2"
 
# Make sure that the log message contains some text.
SVNLOOK=/usr/local/bin/svnlook
LOG=`$SVNLOOK log -t "$TXN" "$REPOS"`
echo "$LOG" | grep "[a-zA-Z0-9]" > /dev/null || exit 1



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