You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Helge Jung <he...@eco-logic-software.de> on 2003/06/29 08:54:38 UTC

Patching file before commit

Hello world,

I've already searched through the svnbook but I didn't find anything
which could help me with my problem:

In my project I've a file called version.txt in which there's only the
version number of my project (so the program knows it's revision number
by reading this file). All what I want is that when someone commits
something this file is updated with the new revision number. In the
hooks there was one making it possible to change files but a) there was
also a warning not to do so and b) the version.txt is never
touched/changed by a user/developer - it should only be changed by the
system.

Has someone a hint and/or solution for me?

Best regards and thanks in advance,
Helge.


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

Re: Patching file before commit

Posted by John Peacock <jp...@rowman.com>.
Helge Jung wrote:
> In my project I've a file called version.txt in which there's only the
> version number of my project (so the program knows it's revision number
> by reading this file). All what I want is that when someone commits
> something this file is updated with the new revision number. In the
> hooks there was one making it possible to change files but a) there was
> also a warning not to do so and b) the version.txt is never
> touched/changed by a user/developer - it should only be changed by the
> system.

I've been thinking about something like this myself, and I believe I have an 
idea which may work.  The key is to make "version.txt" a plain file (i.e. not 
versioned in the repository), and just have it updated/created by the hook 
system for every commit.  In other words, use post_commit rather than 
pre_commit.  I'd have to assume that your repository and web server wc are 
located on the same machine (for ease of scripting) or else you have to use ssh 
or something to create the file on a remote filesystem.

The only difficulty here is that you must create some other method of generating 
this file when checking out a new wc, but that is trivial once you have the 
above script.

HTH

John


-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747


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

RE: Patching file before commit

Posted by Tim Hawkins <ti...@timhawkins.co.uk>.
You could create a small wc on the server, with only a directory containing
the version file, and then schedule a periodic update and commit of the
file. 


-----Original Message-----
From: Helge Jung [mailto:helge@eco-logic-software.de] 
Sent: 29 June 2003 11:56
To: dev@subversion.tigris.org
Subject: Re: Patching file before commit

Max Bowsher wrote:
> Maybe you could generate version.txt from `svnversion .` as
> part of your build process.

Good idea but the problem is that the project contains only PHP scripts
so there is no build process. Otherwise I would have thought of
something like that, too.

Thanks anyway,
Helge.


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



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

Re: Patching file before commit

Posted by Helge Jung <he...@eco-logic-software.de>.
Max Bowsher wrote:
> Maybe you could generate version.txt from `svnversion .` as
> part of your build process.

Good idea but the problem is that the project contains only PHP scripts
so there is no build process. Otherwise I would have thought of
something like that, too.

Thanks anyway,
Helge.


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

Re: Patching file before commit

Posted by Max Bowsher <ma...@ukf.net>.
Helge Jung wrote:
> Hello world,
>
> I've already searched through the svnbook but I didn't find anything
> which could help me with my problem:
>
> In my project I've a file called version.txt in which there's only the
> version number of my project (so the program knows it's revision number
> by reading this file). All what I want is that when someone commits
> something this file is updated with the new revision number. In the
> hooks there was one making it possible to change files but a) there was
> also a warning not to do so and b) the version.txt is never
> touched/changed by a user/developer - it should only be changed by the
> system.
>
> Has someone a hint and/or solution for me?

Maybe you could generate version.txt from `svnversion .` as part of your
build process.

Max.


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

Re: Patching file before commit

Posted by kf...@collab.net.
Philip Martin <ph...@codematters.co.uk> writes:
> "Helge Jung" <he...@eco-logic-software.de> writes:
> > In my project I've a file called version.txt in which there's only the
> > version number of my project (so the program knows it's revision number
> > by reading this file). All what I want is that when someone commits
> > something this file is updated with the new revision number.
> 
> That sounds like the idea for a keyword that gets expanded once only,
> issue 958.

I don't think it would help, as no one is committing to the file in
question (also, issue 958 is but a solar myth until we have a way to
implement it... :-) ).


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

Re: Patching file before commit

Posted by Philip Martin <ph...@codematters.co.uk>.
"Helge Jung" <he...@eco-logic-software.de> writes:

> In my project I've a file called version.txt in which there's only the
> version number of my project (so the program knows it's revision number
> by reading this file). All what I want is that when someone commits
> something this file is updated with the new revision number.

That sounds like the idea for a keyword that gets expanded once only,
issue 958.

-- 
Philip Martin

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