[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How to block files if the exceed number

From: David Weintraub <qazwart_at_gmail.com>
Date: Mon, 27 Jul 2009 14:42:47 -0400

You can't print out the contents of the "svnlook cat" command on a binary
file, and Windows word files are binary. Try this to get the size of the
file $fileName in bytes.

*open (MYFILE, "$fileName");
$numOfBytes = -s MYFILE;

You're looking for the SIZE of the file and not the contents. Don't attempt
to print it out because it's not printable.

You need to do this for every file that has been committed, and then total
the number of bytes of each file. If the total number of bytes is larger
than your predetermined size, do an "exit(2);". If not, do an "exit(0);"

You can use "svnlook log -t$txn" to get the list of files that changed.

   - **

On Mon, Jul 27, 2009 at 4:51 AM, Ilan Yaniv <Ilan.Yaniv_at_timetoknow.org>wrote:

> The thing is that the file that I am checking is binary (word document).
> The hook is written in Perl. I am running the cat command.
> Here is the code example:
> my $command = "$svnlook cat -t \"$txn\" $repos $file";
> my $filecontent = `$command`;
> When I try to print to content to the Tortoise I am getting this error:
> Safe data 'test_ilan/Doc6.doc
> ' was followed by non-ASCII byte 208: unable to convert to/from UTF-8

David Weintraub
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-07-27 20:43:51 CEST

This is an archived mail posted to the Subversion Users mailing list.