You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Reid Priedhorsky <re...@umn.edu> on 2006/09/07 17:28:07 UTC

Enforcing date relationship between files in pre-commit hook

Hi folks,

I'm storing TeX documents in my Subversion repository, and I also store 
the corresponding PDFs, because some people who use the repository don't 
have the tools to generate them.

However, I occasionally leave the PDF out of date in a commit.

Therefore, I would like to write a pre-commit hook that prevents me from 
doing this. The rule would be, if a .tex file is being committed, and a 
corresponding .pdf file is also being committed, and the .tex is newer 
than the .pdf, reject the commit.

However, I can't figure out how to look at the last-modified timestamps 
of the files being committed.

Any ideas?

Thanks very much for any help.

Reid

p.s. If convenient, please CC me on replies, as I'm not subscribed to 
the list.

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

Re: Enforcing date relationship between files in pre-commit hook

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Sep 8, 2006, at 03:03, Reid Priedhorsky wrote:

>>> I'm storing TeX documents in my Subversion repository, and I  
>>> also  store the corresponding PDFs, because some people who use  
>>> the  repository don't have the tools to generate them.
>>>
>>> However, I occasionally leave the PDF out of date in a commit.
>>>
>>> Therefore, I would like to write a pre-commit hook that prevents  
>>> me  from doing this. The rule would be, if a .tex file is being   
>>> committed, and a corresponding .pdf file is also being  
>>> committed,  and the .tex is newer than the .pdf, reject the commit.
>>>
>>> However, I can't figure out how to look at the last-modified   
>>> timestamps of the files being committed.
>>
>> In the pre-commit hook you would use the svnlook command to  
>> examine  the transaction that's in progress. svnlook has many  
>> subcommands  including getting a list of files in the transaction  
>> and getting a  file's properties, including its date.
>
> I found plenty of information on finding which files were in the  
> commit, and the timestamp of the commit (both using svnlook), but I  
> couldn't locate info on last-modified timestamps of individual  
> files in the commit. Could you give a more specific pointer into  
> the documentation?

Oh. I'm sorry. I answered too quickly / didn't completely think about  
your question. Subversion doesn't store the modification date, so  
that's why you're not finding it. If it's essential to your plan, you  
can compile your own version of Subversion which does store the  
modification date. It's in the so-called "text-time" branch here:

http://svn.collab.net/repos/svn/branches/meta-data-versioning/



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

Re: Enforcing date relationship between files in pre-commit hook

Posted by Blair Zajac <bl...@orcaware.com>.
Reid Priedhorsky wrote:
> Ryan Schmidt wrote:
>> On Sep 7, 2006, at 19:28, Reid Priedhorsky wrote:
>>
>>> I'm storing TeX documents in my Subversion repository, and I also  
>>> store the corresponding PDFs, because some people who use the  
>>> repository don't have the tools to generate them.
>>>
>>> However, I occasionally leave the PDF out of date in a commit.
>>>
>>> Therefore, I would like to write a pre-commit hook that prevents me  
>>> from doing this. The rule would be, if a .tex file is being  
>>> committed, and a corresponding .pdf file is also being committed,  
>>> and the .tex is newer than the .pdf, reject the commit.
>>>
>>> However, I can't figure out how to look at the last-modified  
>>> timestamps of the files being committed.
>>
>>
>> In the pre-commit hook you would use the svnlook command to examine  
>> the transaction that's in progress. svnlook has many subcommands  
>> including getting a list of files in the transaction and getting a  
>> file's properties, including its date.
> 
> I found plenty of information on finding which files were in the commit, 
> and the timestamp of the commit (both using svnlook), but I couldn't 
> locate info on last-modified timestamps of individual files in the 
> commit. Could you give a more specific pointer into the documentation?

The Subversion client doesn't send the file's last modified time to the server.

Your best bet in this case is to do the test, if there's a commit to any of the 
.tex files, then the .pdf file must also be in the commit.

Regards,
Blair

-- 
Blair Zajac, Ph.D.
<bl...@orcaware.com>
Subversion training, consulting and support
http://www.orcaware.com/svn/

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

Re: Enforcing date relationship between files in pre-commit hook

Posted by Reid Priedhorsky <re...@umn.edu>.
Ryan Schmidt wrote:
> On Sep 7, 2006, at 19:28, Reid Priedhorsky wrote:
> 
>> I'm storing TeX documents in my Subversion repository, and I also  
>> store the corresponding PDFs, because some people who use the  
>> repository don't have the tools to generate them.
>>
>> However, I occasionally leave the PDF out of date in a commit.
>>
>> Therefore, I would like to write a pre-commit hook that prevents me  
>> from doing this. The rule would be, if a .tex file is being  
>> committed, and a corresponding .pdf file is also being committed,  and 
>> the .tex is newer than the .pdf, reject the commit.
>>
>> However, I can't figure out how to look at the last-modified  
>> timestamps of the files being committed.
> 
> 
> In the pre-commit hook you would use the svnlook command to examine  the 
> transaction that's in progress. svnlook has many subcommands  including 
> getting a list of files in the transaction and getting a  file's 
> properties, including its date.

I found plenty of information on finding which files were in the commit, 
and the timestamp of the commit (both using svnlook), but I couldn't 
locate info on last-modified timestamps of individual files in the 
commit. Could you give a more specific pointer into the documentation?

Thanks very much,

Reid

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

Re: Enforcing date relationship between files in pre-commit hook

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Sep 7, 2006, at 19:28, Reid Priedhorsky wrote:

> I'm storing TeX documents in my Subversion repository, and I also  
> store the corresponding PDFs, because some people who use the  
> repository don't have the tools to generate them.
>
> However, I occasionally leave the PDF out of date in a commit.
>
> Therefore, I would like to write a pre-commit hook that prevents me  
> from doing this. The rule would be, if a .tex file is being  
> committed, and a corresponding .pdf file is also being committed,  
> and the .tex is newer than the .pdf, reject the commit.
>
> However, I can't figure out how to look at the last-modified  
> timestamps of the files being committed.

In the pre-commit hook you would use the svnlook command to examine  
the transaction that's in progress. svnlook has many subcommands  
including getting a list of files in the transaction and getting a  
file's properties, including its date.



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