You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by marcus314 <ma...@yahoo.com> on 2005/10/26 08:25:55 UTC

filter files before commit

Hi group,

I would like to always run a script on special types
of files before committing them to the repository,
e.g. "tidy" on all .html-files.

Is there a way to do this automatically, i.e., so that
I would just have to "svn commit foo.html"?

Best regards,
Marcus



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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

Re: filter files before commit

Posted by Dirk Hoffmann <dh...@web.de>.
See the second warning in

http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks

Another approach could be to have two separate repositories (not just
different directories within the same directory). You could then let the
pre-commit hook of the first repository run the html-tidy program and
check in the new files into the second repository.

Of course you would then have two repositories with nearly the same
content. The first with "raw" files and the second with "tidy" files.
Unfortunately the raw and tidy files will also live in different working
copies. The user would have to manually copy files from the tidy over to
the raw working copy.

I never tried this but it should work.

You could also write a script that periodically tidies your files.

Regards,
Dirk


Dirk Hoffmann wrote:
> Hi Marcus,
>
> you may be thinking of writing a hook script to do the job but that
> won't work because then the working copy would no longer be in sync with
> the repo (Hope I remember this correctly).
>
> Better write a hook script which validates that your html is tidy and
> denies the commit if not.
>
> Regards,
> Dirk
>
> marcus314 wrote:
>   
>> Hi group,
>>
>> I would like to always run a script on special types
>> of files before committing them to the repository,
>> e.g. "tidy" on all .html-files.
>>
>> Is there a way to do this automatically, i.e., so that
>> I would just have to "svn commit foo.html"?
>>
>> Best regards,
>> Marcus
>>
>>
>>
>> 	
>> 		
>> __________________________________ 
>> Yahoo! Mail - PC Magazine Editors' Choice 2005 
>> http://mail.yahoo.com
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>   



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

Re: filter files before commit

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Oct 27, 2005, at 10:25, marcus314 wrote:

> is it not possible via a hook script to first modify
> the *working* copy of the file, and then commit this
> modified version to the repo?

No, it is not possible, nor is the possibility desired by the  
Subversion developers, as I understand it. The job of a revision  
control tool is to store the things it gets sent as-is, not to modify  
them unexpectedly behind the committer's back.


> PS. the documentation is a bit scarce regarding hook
> scripts. Is there a site where I can find some
> detailed examples how to e.g. test all files *.foo
> with a script `isvalidfoo'?

I'm not aware of any such site. The documentation was clear to me,  
but if you need more pointers, there have been many posts on this  
list. You can probably find some of them by searching http:// 
svn.haxx.se/users/



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

Re: filter files before commit

Posted by marcus314 <ma...@yahoo.com>.
Hi Dirk,

is it not possible via a hook script to first modify
the *working* copy of the file, and then commit this
modified version to the repo?

Regards,
Marcus

PS. the documentation is a bit scarce regarding hook
scripts. Is there a site where I can find some
detailed examples how to e.g. test all files *.foo
with a script `isvalidfoo'?

Dirk Hoffmann <dh...@web.de> wrote:
> Hi Marcus,
> 
> you may be thinking of writing a hook script to do
> the job but that
> won't work because then the working copy would no
> longer be in sync with
> the repo (Hope I remember this correctly).
> 
> Better write a hook script which validates that your
> html is tidy and
> denies the commit if not.
> 
> Regards,
> Dirk



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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

Re: filter files before commit

Posted by Dirk Hoffmann <dh...@web.de>.
Hi Marcus,

you may be thinking of writing a hook script to do the job but that
won't work because then the working copy would no longer be in sync with
the repo (Hope I remember this correctly).

Better write a hook script which validates that your html is tidy and
denies the commit if not.

Regards,
Dirk

marcus314 wrote:
> Hi group,
>
> I would like to always run a script on special types
> of files before committing them to the repository,
> e.g. "tidy" on all .html-files.
>
> Is there a way to do this automatically, i.e., so that
> I would just have to "svn commit foo.html"?
>
> Best regards,
> Marcus
>
>
>
> 	
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> 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: filter files before commit

Posted by Johan Appelgren <jo...@gmail.com>.
On 10/26/05, marcus314 <ma...@yahoo.com> wrote:
> Hi group,
>
> I would like to always run a script on special types
> of files before committing them to the repository,
> e.g. "tidy" on all .html-files.
>
> Is there a way to do this automatically, i.e., so that
> I would just have to "svn commit foo.html"?

You could use a shellscript that runs tidy and then commits. But are
you sure you really want this to be automatical, do you never inspect
the result of the tools you run on your files before commiting?

/Johan

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