You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Ehler, Benedikt" <B....@kostal.com> on 2008/01/08 14:54:37 UTC

Automatically change property

Hello all!

Is it possible to change a property via a hook script? We want to emulate a
CVS-like revision number by properties. So every file should get a property
called "Revision_Number" or something like that. The value of this prop
should be counted up every time a new version of this file is checked in
(like CVS/PVCS).
So every time a new version should be checked in, a script will check the
"Revision_Number"-property and will then increase it. 

I know man should not do this, but it was a concrete question of my boss. So
please don't say this is unnecessary, i know it.

Thank you for your answers!
Greetings



Leopold KOSTAL GmbH & Co. KG - Sitz Lüdenscheid, Registergericht Iserlohn HRA 2854, phG Kostal Verwaltungsgesellschaft mbH, Registergericht Iserlohn HRB 4061 - USt-Id-Nr./Vat No.: DE 125800885
Post- und Werksanschrift: An der Bellmerei 10, D-58513 Lüdenscheid * Telefon: +49 2351 16-0 * Telefax: +49 2351 16-2400 Bellmerei
Geschäftsführung: Dipl.-Kfm. Helmut Kostal (Vorsitzender), Dipl.-Wirtsch.-Ing. Hermann Eidel, Dipl.-Ing. Marwin Kinzl, Dr.-Ing. Ludger Laufenberg

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


RE: Re: Automatically change property

Posted by "Reedick, Andrew" <jr...@ATT.COM>.
> -----Original Message-----
> From: Greg Thomas [mailto:thomasgd@omc.bt.co.uk]
> Sent: Tuesday, January 08, 2008 11:50 AM
> To: Ehler, Benedikt; users@subversion.tigris.org
> Subject: Re: Automatically change property
> 
> On Tue, 8 Jan 2008 15:54:37 +0100 , "Ehler, Benedikt"
> <B....@kostal.com> wrote:
> 
> 
> Yes, although you'll double the number of commits in your repository.
> You would need to write a post-commit script to


Does the revision absolutely need to be stored as a property?  Or can
the revision count be computed on the fly?

REV_COUNT = `svn log -q --stop-on-copy
svn://server/repos/path/.../foo.java | grep '^r'  | wc -l`



*****

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA625


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


Re: Automatically change property

Posted by km...@rockwellcollins.com.
Matt Pounsett <ma...@conundrum.com> wrote on 01/09/2008 11:15:46 AM:
> -----BEGIN PGP SIGNED MESSAGE-----
> On 2008-Jan-09, at 11:57, kmradke@rockwellcollins.com wrote:
> 
> >> That's a *revision* property, not a file property.  Revision
> >> properties apply to the entire commit (svn:log, svn:author, and
> >> svn:date are the only ones that come to mind).  The initial question
> >> in this thread was about a file property, which can't be changed the
> >> same way as a revprop.
> >
> > I realized this.  I believe you can add arbitrary revision
> > properties.  It would take more information stored in the
> > revision property, such as a filepath/version combo, but it should
> > still be possible (albeit highly unrecommended).
> 
> It's possible I misunderstood the original thing you were trying to 
> do, so just to clarify... as I understand it you're trying to 
> implement per-file version numbers, right?  So.. whenever file X gets 
> modified, some property with a number in it gets advanced.  Is this 
> correct?
> 
> If so, then advancing that number when its stored in a revision 
> property is going to be a more complex task.  You can't just retrieve 
> the number by looking at the HEAD revision of that file.. you'll need 
> to search back through the repository for the last time the file was 
> modified, get that revision number, look up your custom version 
> number from the revprop on that version, and then modify the revprop 
> on the HEAD.
> 
> Not impossible, but you're looking at a lot of work to do something 
> you probably don't want to do anyway. :)

Well, it wasn't me who originally wanted to do it, I was just trying
to think up *different* ways to do it other than using a file property.

And I completely agree, the complexity of using a revision property
makes it highly unrecommended.  Getting the last changed revision
isn't too bad, but it would probably take a separate utility to
help the user visualize the information on a per file basis, since
the info is now stored per revision and not per file, which
kinda defeats the whole purpose.

Kevin R.

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

Re: Automatically change property

Posted by Matt Pounsett <ma...@conundrum.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 2008-Jan-09, at 11:57, kmradke@rockwellcollins.com wrote:

>> That's a *revision* property, not a file property.  Revision
>> properties apply to the entire commit (svn:log, svn:author, and
>> svn:date are the only ones that come to mind).  The initial question
>> in this thread was about a file property, which can't be changed the
>> same way as a revprop.
>
> I realized this.  I believe you can add arbitrary revision
> properties.  It would take more information stored in the
> revision property, such as a filepath/version combo, but it should
> still be possible (albeit highly unrecommended).

It's possible I misunderstood the original thing you were trying to  
do, so just to clarify... as I understand it you're trying to  
implement per-file version numbers, right?  So.. whenever file X gets  
modified, some property with a number in it gets advanced.  Is this  
correct?

If so, then advancing that number when its stored in a revision  
property is going to be a more complex task.  You can't just retrieve  
the number by looking at the HEAD revision of that file.. you'll need  
to search back through the repository for the last time the file was  
modified, get that revision number, look up your custom version  
number from the revprop on that version, and then modify the revprop  
on the HEAD.

Not impossible, but you're looking at a lot of work to do something  
you probably don't want to do anyway. :)


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFHhQFHmFeRJ0tjIxERAkuqAJ0VNzk11IXtRDnfC4zgMR7uc4CZXgCfRWH9
4/BnvXIhFZit5e0tyCgYLEI=
=EXI9
-----END PGP SIGNATURE-----

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

Re: Automatically change property

Posted by km...@rockwellcollins.com.
Matt Pounsett <ma...@conundrum.com> wrote on 01/09/2008 10:47:20 AM:
> On 2008-Jan-09, at 11:38, kmradke@rockwellcollins.com wrote:
> > The pre-commit.tmpl file appears to suggest changing revision 
> > properties
> > is ok:
> >
> > #   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***
> > #   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***
> >
> > I haven't tested to see what happens, but if this is true, it would
> > mean the extra commit step should not be required if you enable
> > revision propchanges on your repo and you use --revprop instead.
> >
> > Anyone see any big problems with this?
> 
> That's a *revision* property, not a file property.  Revision 
> properties apply to the entire commit (svn:log, svn:author, and 
> svn:date are the only ones that come to mind).  The initial question 
> in this thread was about a file property, which can't be changed the 
> same way as a revprop.

I realized this.  I believe you can add arbitrary revision
properties.  It would take more information stored in the
revision property, such as a filepath/version combo, but it should
still be possible (albeit highly unrecommended).

Kevin R.

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

Re: Automatically change property

Posted by Matt Pounsett <ma...@conundrum.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 2008-Jan-09, at 11:38, kmradke@rockwellcollins.com wrote:

> The pre-commit.tmpl file appears to suggest changing revision  
> properties
> is ok:
>
> #   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***
> #   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***
>
> I haven't tested to see what happens, but if this is true, it would
> mean the extra commit step should not be required if you enable
> revision propchanges on your repo and you use --revprop instead.
>
> Anyone see any big problems with this?

That's a *revision* property, not a file property.  Revision  
properties apply to the entire commit (svn:log, svn:author, and  
svn:date are the only ones that come to mind).  The initial question  
in this thread was about a file property, which can't be changed the  
same way as a revprop.

Mat


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)

iD8DBQFHhPqZmFeRJ0tjIxERAlyeAJ4x42QqWWHKeGkAownxhEggDHsLMQCfQY5D
9vddM381X6tY8++QSGoq9gI=
=o/Gb
-----END PGP SIGNATURE-----

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

Re: Automatically change property

Posted by km...@rockwellcollins.com.
Greg Thomas <th...@omc.bt.co.uk> wrote on 01/08/2008 10:50:00 AM:
> On Tue, 8 Jan 2008 15:54:37 +0100 , "Ehler, Benedikt"
> <B....@kostal.com> wrote:
> 
> >Is it possible to change a property via a hook script? We want to 
emulate a
> >CVS-like revision number by properties. So every file should get a 
property
> >called "Revision_Number" or something like that. The value of this prop
> >should be counted up every time a new version of this file is checked 
in
> >(like CVS/PVCS).
> 
> Yes, although you'll double the number of commits in your repository.
> You would need to write a post-commit script to 
> 
> (a) check out a local copy
> (b) update the property using "svn propset"
> (c) commit the change back
> (d) tidy up the local working copy
> 
> Note that the committers working copy will immediately be out of date,
> but assuming they don't edit the property manually I don't see any
> merge conflicts occurring. 
> 
> Note that there is a long standing issue -
> http://subversion.tigris.org/issues/show_bug.cgi?id=2238 - which would
> allow you to perform a "svn propset" on the repository URL directly,
> which would make the post-commit script somewhat easier to write -
> there would be no need to checkout a local working copy.
> 
> Whatever you do, don't change the file in the pre-commit hook.

The pre-commit.tmpl file appears to suggest changing revision properties 
is ok:

#   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***
#   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***

I haven't tested to see what happens, but if this is true, it would
mean the extra commit step should not be required if you enable
revision propchanges on your repo and you use --revprop instead.

Anyone see any big problems with this?

Kevin R.

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

Re: Automatically change property

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Tue, 8 Jan 2008 15:54:37 +0100 , "Ehler, Benedikt"
<B....@kostal.com> wrote:

>Is it possible to change a property via a hook script? We want to emulate a
>CVS-like revision number by properties. So every file should get a property
>called "Revision_Number" or something like that. The value of this prop
>should be counted up every time a new version of this file is checked in
>(like CVS/PVCS).

Yes, although you'll double the number of commits in your repository.
You would need to write a post-commit script to 

(a) check out a local copy
(b) update the property using "svn propset"
(c) commit the change back
(d) tidy up the local working copy

Note that the committers working copy will immediately be out of date,
but assuming they don't edit the property manually I don't see any
merge conflicts occurring. 

Note that there is a long standing issue -
http://subversion.tigris.org/issues/show_bug.cgi?id=2238 - which would
allow you to perform a "svn propset" on the repository URL directly,
which would make the post-commit script somewhat easier to write -
there would be no need to checkout a local working copy.

Whatever you do, don't change the file in the pre-commit hook.

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

AW: Automatically change property

Posted by Felix Gilcher <fe...@exozet.com>.
Hi,

I won't say it's unnecessary but close to impossible - you *must* not alter the commit in a pre-commit hook or you may cause havoc. You may, however use a post-commit hook to make a separate commit to update the property - possibly leading to conflicts on pretty much every following commit. The best way to do this might be wrapping the commandline client in a script that updates the property just before the commit. But then you can't use subclipse, tortoise or anything else any more. 

[sorry for top-posting, this outlook is way too stupid]

Regards

felix

--
Felix Gilcher
Head of IT Development

E-Mail:  mailto:felix.gilcher@exozet.com
URL:     http://www.exozet.com/
Tel:    +49 (30) 2 46 56 0 - 0
Fax:    +49 (30) 2 46 56 0 - 29



-----Ursprüngliche Nachricht-----
Von: Ehler, Benedikt [mailto:B.Ehler@kostal.com] 
Gesendet: Dienstag, 8. Januar 2008 15:55
An: 'users@subversion.tigris.org'
Betreff: Automatically change property

Hello all!

Is it possible to change a property via a hook script? We want to emulate a
CVS-like revision number by properties. So every file should get a property
called "Revision_Number" or something like that. The value of this prop
should be counted up every time a new version of this file is checked in
(like CVS/PVCS).
So every time a new version should be checked in, a script will check the
"Revision_Number"-property and will then increase it. 

I know man should not do this, but it was a concrete question of my boss. So
please don't say this is unnecessary, i know it.

Thank you for your answers!
Greetings



Leopold KOSTAL GmbH & Co. KG - Sitz Lüdenscheid, Registergericht Iserlohn HRA 2854, phG Kostal Verwaltungsgesellschaft mbH, Registergericht Iserlohn HRB 4061 - USt-Id-Nr./Vat No.: DE 125800885
Post- und Werksanschrift: An der Bellmerei 10, D-58513 Lüdenscheid * Telefon: +49 2351 16-0 * Telefax: +49 2351 16-2400 Bellmerei
Geschäftsführung: Dipl.-Kfm. Helmut Kostal (Vorsitzender), Dipl.-Wirtsch.-Ing. Hermann Eidel, Dipl.-Ing. Marwin Kinzl, Dr.-Ing. Ludger Laufenberg

---------------------------------------------------------------------
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: Automatically change property

Posted by "Reedick, Andrew" <jr...@ATT.COM>.
> -----Original Message-----
> From: Ehler, Benedikt [mailto:B.Ehler@kostal.com]
> Sent: Tuesday, January 08, 2008 9:55 AM
> To: 'users@subversion.tigris.org'
> Subject: Automatically change property
> 
> Hello all!
> 
> Is it possible to change a property via a hook script? We want to
> emulate a
> CVS-like revision number by properties. So every file should get a
> property
> called "Revision_Number" or something like that. The value of this
prop
> should be counted up every time a new version of this file is checked
> in
> (like CVS/PVCS).
> So every time a new version should be checked in, a script will check
> the
> "Revision_Number"-property and will then increase it.
> 
> I know man should not do this, but it was a concrete question of my
> boss. So
> please don't say this is unnecessary, i know it.
> 

What's next?  Assigning FM radio stations (by genre) to the songs on his
MP3 player?  =P


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