You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by x nooby <xn...@yahoo.com> on 2005/11/29 19:50:09 UTC

Can Subversion tweak files during a commit?


I have several C programs that use a header-file
(rec.h) which describes a structure that is written to
a datafile.  Our current Version control system allows
a directive to be inserted in to the header file that
will cause a timestamp to be updated whenever the
header is committed.  

The C programs that use this header compare the
timestamps they were built with, in order to make sure
their structs are compatible.


For example:

   rec.h before commit
   --------------------
   int cust_id=0;
   char timestamp[] = {##timestamp_as_chars##};
   float amount=0.0;

   rec.h after commit
   --------------------
   int cust_id=0;
   char timestamp[] = {"051127:22:02:34"};
   float amount=0.0;



Does Subversion have a way to insert something using a
directive, similar to the one above?

I'm thinking I could use a "pre-commit hook-script",
but would the person committing the file get the one
with the timestamp inserted?

Or is there some other way to solve this?  Basically,
the programs using the header file need to be able to
tell if they were built with the same header file.

thanks!



		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free. 
http://music.yahoo.com/unlimited/

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

Re: Can Subversion tweak files during a commit?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Nov 29, 2005, at 20:50, x nooby wrote:

> a datafile.  Our current Version control system allows
> a directive to be inserted in to the header file that
> will cause a timestamp to be updated whenever the
> header is committed.

> Does Subversion have a way to insert something using a
> directive, similar to the one above?

Try the Date keyword:

http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.4

If that's not the format you want, write C code into your project  
that transforms it into the format you want.


> I'm thinking I could use a "pre-commit hook-script",
> but would the person committing the file get the one
> with the timestamp inserted?

Don't try to modify a file's data in a pre-commit hook. While your  
modified file will end up in the repository, the user's working copy  
will retain the unmodified file, but will think it has the same  
version as the repository. This will break subsequent diffs.



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