You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Brian Huddleston <br...@huddleston.net> on 2005/04/14 05:32:20 UTC

Hack/Work Around for Log Message Templates?

Hi guys,

Some advice if you would be so kind.  

Background:

I'm hoping to move our dev organization over to Subversion sometime in the fairly short term.  I finally got a successfull cvs2svn after editing a few hundred RCS file that were boogered in various ways and was happy happy happy.  I was actually typing up to e-mail to get volunteers to test everything out, perform their normal operations, etc.

That's when I ran into an issue that is a show stopper in our case.  We use CVS commit templates as an integration to our larger SCM system.

Basically we have a template:

Active Issues:
Resolved Issues:
Description:

Where the Issues fields contain Scarab IDs and Description is more of the traditional commit message.

We have a precommit hook that makes sure the Issues: field have properly formatted IDs and that Description at least gets minimally filled in.  I assume I can do this by modifying one of the hook scripts appropriately.  (Subversion seems a lot more flexible than CVS on that front).

However, a little doc searching followed by bug database diving revealed that 1973 (Log message templates) wasn't yet implemented.

So, I am wondering what would be a good work around until 1973 trickles up to the TODO list?

Maybe setting the editor variable to a script?  I'm not sure how it works in the svn case.

I'm trying to avoid:

* Developer does an SVN commit
* Developer composes a nice long commit message about his commit, enough to bring a tear to the eye of any build manager
* Developer curses "I forgot to load the template"

or 

* Developer does an SVN commit
* Developer pops up with the template and the message from the previous commit
* Developer curses and deletes out all the old info before entering his commit information

While the idea of moving to SVN seems generally popular.  I want to grease the wheels as much as possible and endure the minimum amount of grief from the "moved my cheese" crowd.

Any ideas for clever work-alikes?

Thanks much
-Brian

Re: Hack/Work Around for Log Message Templates?

Posted by Brian Huddleston <br...@huddleston.net>.
For those of you who are curious here is the script I came up with (windows 
version):

@echo off
set FILE=%1

echo Active Issues: > %FILE%.tmp
echo Resolved Issues: >> %FILE%.tmp
echo Description (what changed and why): >> %FILE%.tmp

type %FILE% >> %FILE%.tmp

move %FILE%.tmp %FILE%
%SVN_REAL_EDITOR% %FILE%

So you set a couple of environmental variables:

SVN_EDITOR to the path to the name of the batch file.

SVN_REAL_EDITOR to the name of whatever your real EDITOR should be.

*boom* You've just converted a show stopper (was for us anyway) into a mere 
support and CM headache. :-)

*wonders what he would have to bribe Karl with to get him to put 1973 on the 
roadmap*

-Brian
----- Original Message ----- 
From: "Brian Huddleston" <br...@huddleston.net>
To: "Ph. Marek" <ph...@bmlv.gv.at>; <us...@subversion.tigris.org>
Cc: "Daniel Patterson" <da...@danpat.net>
Sent: Thursday, April 14, 2005 7:25 AM
Subject: Re: Hack/Work Around for Log Message Templates?


> Yeah, I was thinking something along that line:
>
> pseudo code:
>
> mv temp-filename-from-subversion temp-filename-from-subversion.tmp
> cat template >> temp-filename-from-subversion
> cat temp-filename-from-subversion.tmp >> temp-filename-from-subversion
> rm temp-filename-from-subversion.tmp
> $EDITOR temp-filename-from-subversion
>
> Does anyone see any issues with that?
>
> -Brian
> ----- Original Message ----- 
> From: "Ph. Marek" <ph...@bmlv.gv.at>
> To: <us...@subversion.tigris.org>
> Cc: "Daniel Patterson" <da...@danpat.net>; "Brian Huddleston" 
> <br...@huddleston.net>
> Sent: Thursday, April 14, 2005 3:50 AM
> Subject: Re: Hack/Work Around for Log Message Templates?
>
>
>> On Thursday 14 April 2005 10:15, Daniel Patterson wrote:
>>>    Maybe write a small "svncommit" wrapper that does something like:
>>>
>>>    ------------------------------------------
>>>    #!/bin/sh
>>>
>>>    cat <<EOT > template.tmp
>>>    Active Issues:
>>>    Resolved Issues:
>>>    Description:
>>>    EOT
>>>    # TODO: check VISUAL, EDITOR and have a fallback....
>>>    $EDITOR template.tmp
>>>    # TODO: Check return code from editor, quit if it fails
>>>    svn commit -F template.tmp "$@"
>>>    # TODO: maybe only delete this if the commit is ok?
>>>    rm template.temp
>>>    ------------------------------------------
>>>
>>>    Heck, you could write a wrapper for the whole of the "svn" command,
>>>    and intercept calls to "commit".  Unfortunately, that won't pick up
>>>    the list of files and stick them on the bottom, unlike the default
>>>    incantation of $EDITOR.  You might be able to do some trickery
>>>    with "$@" and "svn st" to work out, and then fiddle with
>>>    template.tmp to remove them before you call "svn commit"...
>>>
>>>    I hope you've got a nice way of rolling this out to everyone
>>>    though :-)
>> How about just setting SVN_EDITOR or EDITOR to a script on svn-commit :-)
>>
>>
>> Regards,
>>
>> Phil
>>
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
> 



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

Re: Hack/Work Around for Log Message Templates?

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Thu, 14 Apr 2005 11:06:32 -0400, Andrew Thompson
<su...@aktzero.com> wrote:

>Isn't $EDITOR supposed to reference an editor, like say vi?

Yes, but the idea is that instead $EDITOR refers to a script that
creates the required template before launching vi.

Greg
-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

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

Re: Hack/Work Around for Log Message Templates?

Posted by Andrew Thompson <su...@aktzero.com>.
Brian Huddleston wrote:
> Yeah, I was thinking something along that line:
> 
> pseudo code:
> 
> mv temp-filename-from-subversion temp-filename-from-subversion.tmp
> cat template >> temp-filename-from-subversion
> cat temp-filename-from-subversion.tmp >> temp-filename-from-subversion
> rm temp-filename-from-subversion.tmp
> $EDITOR temp-filename-from-subversion
> 
> Does anyone see any issues with that?

Isn't $EDITOR supposed to reference an editor, like say vi?

$EDITOR vi temp-filename-from-subversion

-- 
Andrew Thompson
http://aktzero.com/
Interested in a hosted SVN repository? Email me, let's talk...

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

Re: Hack/Work Around for Log Message Templates?

Posted by Brian Huddleston <br...@huddleston.net>.
Yeah, I was thinking something along that line:

pseudo code:

mv temp-filename-from-subversion temp-filename-from-subversion.tmp
cat template >> temp-filename-from-subversion
cat temp-filename-from-subversion.tmp >> temp-filename-from-subversion
rm temp-filename-from-subversion.tmp
$EDITOR temp-filename-from-subversion

Does anyone see any issues with that?

-Brian
----- Original Message ----- 
From: "Ph. Marek" <ph...@bmlv.gv.at>
To: <us...@subversion.tigris.org>
Cc: "Daniel Patterson" <da...@danpat.net>; "Brian Huddleston" 
<br...@huddleston.net>
Sent: Thursday, April 14, 2005 3:50 AM
Subject: Re: Hack/Work Around for Log Message Templates?


> On Thursday 14 April 2005 10:15, Daniel Patterson wrote:
>>    Maybe write a small "svncommit" wrapper that does something like:
>>
>>    ------------------------------------------
>>    #!/bin/sh
>>
>>    cat <<EOT > template.tmp
>>    Active Issues:
>>    Resolved Issues:
>>    Description:
>>    EOT
>>    # TODO: check VISUAL, EDITOR and have a fallback....
>>    $EDITOR template.tmp
>>    # TODO: Check return code from editor, quit if it fails
>>    svn commit -F template.tmp "$@"
>>    # TODO: maybe only delete this if the commit is ok?
>>    rm template.temp
>>    ------------------------------------------
>>
>>    Heck, you could write a wrapper for the whole of the "svn" command,
>>    and intercept calls to "commit".  Unfortunately, that won't pick up
>>    the list of files and stick them on the bottom, unlike the default
>>    incantation of $EDITOR.  You might be able to do some trickery
>>    with "$@" and "svn st" to work out, and then fiddle with
>>    template.tmp to remove them before you call "svn commit"...
>>
>>    I hope you've got a nice way of rolling this out to everyone
>>    though :-)
> How about just setting SVN_EDITOR or EDITOR to a script on svn-commit :-)
>
>
> Regards,
>
> Phil
>
>
>
> 



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

Re: Hack/Work Around for Log Message Templates?

Posted by "Ph. Marek" <ph...@bmlv.gv.at>.
On Thursday 14 April 2005 10:15, Daniel Patterson wrote:
>    Maybe write a small "svncommit" wrapper that does something like:
>
>    ------------------------------------------
>    #!/bin/sh
>
>    cat <<EOT > template.tmp
>    Active Issues:
>    Resolved Issues:
>    Description:
>    EOT
>    # TODO: check VISUAL, EDITOR and have a fallback....
>    $EDITOR template.tmp
>    # TODO: Check return code from editor, quit if it fails
>    svn commit -F template.tmp "$@"
>    # TODO: maybe only delete this if the commit is ok?
>    rm template.temp
>    ------------------------------------------
>
>    Heck, you could write a wrapper for the whole of the "svn" command,
>    and intercept calls to "commit".  Unfortunately, that won't pick up
>    the list of files and stick them on the bottom, unlike the default
>    incantation of $EDITOR.  You might be able to do some trickery
>    with "$@" and "svn st" to work out, and then fiddle with
>    template.tmp to remove them before you call "svn commit"...
>
>    I hope you've got a nice way of rolling this out to everyone
>    though :-)
How about just setting SVN_EDITOR or EDITOR to a script on svn-commit :-)


Regards,

Phil




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

Re: Hack/Work Around for Log Message Templates?

Posted by Daniel Patterson <da...@danpat.net>.
Brian Huddleston wrote:
> So, I am wondering what would be a good work around until 1973 trickles up to the TODO list?
> 
> Maybe setting the editor variable to a script?  I'm not sure how it works in the svn case.

   Maybe write a small "svncommit" wrapper that does something like:

   ------------------------------------------
   #!/bin/sh

   cat <<EOT > template.tmp
   Active Issues:
   Resolved Issues:
   Description:
   EOT
   # TODO: check VISUAL, EDITOR and have a fallback....
   $EDITOR template.tmp
   # TODO: Check return code from editor, quit if it fails
   svn commit -F template.tmp "$@"
   # TODO: maybe only delete this if the commit is ok?
   rm template.temp
   ------------------------------------------

   Heck, you could write a wrapper for the whole of the "svn" command,
   and intercept calls to "commit".  Unfortunately, that won't pick up
   the list of files and stick them on the bottom, unlike the default
   incantation of $EDITOR.  You might be able to do some trickery
   with "$@" and "svn st" to work out, and then fiddle with
   template.tmp to remove them before you call "svn commit"...

   I hope you've got a nice way of rolling this out to everyone
   though :-)

daniel

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

Re: Hack/Work Around for Log Message Templates?

Posted by Brian Huddleston <br...@huddleston.net>.
Nice feature.  Unfortunately my guys are 99% command line. :-/

----- Original Message ----- 
From: "Steve Williams" <st...@kromestudios.com>
To: <us...@subversion.tigris.org>
Sent: Thursday, April 14, 2005 12:42 AM
Subject: Re: Hack/Work Around for Log Message Templates?


> Brian Huddleston wrote:
>> That's when I ran into an issue that is a show stopper in our case.  We
>> use CVS commit templates as an integration to our larger SCM system.
>>
>> Basically we have a template:
>>
>> Active Issues:
>> Resolved Issues:
>> Description:
>>
>> Where the Issues fields contain Scarab IDs and Description is more of
>> the traditional commit message.
>
> If you are using Windows and TortoiseSVN, then it supports the bugtraq
> properties that may be able to do what you want.  See this page for more
> information.
> http://tortoisesvn.tigris.org/docs/TortoiseSVN_en/ch04s10.html
>
> -- 
> Sly
>
>
>
>
> This message and its attachments may contain legally privileged or 
> confidential information. This message is intended for the use of
> the individual or entity to which it is addressed. If you are not the 
> addressee indicated in this message, or the employee or
> agent responsible for delivering the message to the intended recipient, 
> you may not copy or deliver this message or its attachments
> to anyone. Rather, you should permanently delete this message and its 
> attachments and kindly notify the sender by reply e-mail. Any
> content of this message and its attachments, which does not relate to the 
> official business of the sending company must be taken not
> to have been sent or endorsed by the sending company or any of its related 
> entities. No warranty is made that the e-mail or attachment(s)
> are free from computer virus or other defect.
>
>


--------------------------------------------------------------------------------


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



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

Re: Hack/Work Around for Log Message Templates?

Posted by Steve Williams <st...@kromestudios.com>.
Brian Huddleston wrote:
> That's when I ran into an issue that is a show stopper in our case.  We 
> use CVS commit templates as an integration to our larger SCM system.
>  
> Basically we have a template:
>  
> Active Issues:
> Resolved Issues:
> Description:
>  
> Where the Issues fields contain Scarab IDs and Description is more of 
> the traditional commit message.

If you are using Windows and TortoiseSVN, then it supports the bugtraq 
properties that may be able to do what you want.  See this page for more 
information.
http://tortoisesvn.tigris.org/docs/TortoiseSVN_en/ch04s10.html

-- 
Sly




This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of
the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or
agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments
to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any
content of this message and its attachments, which does not relate to the official business of the sending company must be taken not
to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s)
are free from computer virus or other defect.