[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Help with checkin hook

From: David Weintraub <qazwart_at_gmail.com>
Date: Wed, 13 Aug 2008 12:14:40 -0400

You can automatically add the needed svn:keywords property by
configuring autoproperties in the config file. You can also write a
hook to test whether or not this property is on a file before allowing
it to be checked in. However, I don't think keyword expansion is a
good idea.

Most revision control systems no longer use keywords because this
information is easily found via various commands. For example, "svn
log <file>" and "svn info <file>" will give you all the information
found in the embedded keywords.

The problem with keyword expansion comes when you do diffs and merges.
Whenever you do a diff, there is a diff in the expanded keywords --
even though that particular difference is completely meaningless. It
makes it troublesome when you're trying to find changes between two
revisions. It presents a lot of noise that developers have to parse
through.

Even worse is when you do a merge between two branches. Each keyword
expansion is not only a diff, but a merge conflict! Now, you have to
resolve dozens or maybe hundreds of these useless keyword diffs in
order to do your merge.

Of the modern version control systems, I think only Perforce and
Subversion allow for keyword expansion, and only if explicitly turned
on.

As for the $Log$ not being used in Subversion. Try this in CVS:

$ #Create a file with the $Log$ keyword.
$ cat > myfile <<EOF
The log message
$Log$
EOF

$ cvs add myfile #Adds file to CVS
$ cvs commit -m"I added a $Log$ keyword to the file"

Now, every time you checkout myfile, the log message will double the
number of log lines each time! Talk about fun!

--
David Weintraub
qazwart_at_gmail.com
On Wed, Aug 13, 2008 at 6:33 AM, James Green <James.Green_at_occam-dm.com> wrote:
>> You should not modify the contents of a commit via hook. By doing so,
>> the committer's working copy is immediately rendered out of date. This
>> has been rehashed a lot on this mailing list.
>>
>> Last Revision date/time/revision number is already available via
>> keywords. See
>> http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.
>> keywords.html
>>
>> "History" will not be made available as an SVN keyword ever, most
>> likely. See http://subversion.tigris.org/faq.html#log-in-source
>
> That's great info, thanks Andy.
>
> Having looked into configuring this today it seems the only way to
> switch this keyword substitution on is by setting these on a file by
> file basis in each repository.
>
> Is that correct?
>
> Regards,
>
> James.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: users-help_at_subversion.tigris.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-13 18:15:17 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.