Return-Path: Delivered-To: apmail-subversion-users-archive@minotaur.apache.org Received: (qmail 11910 invoked from network); 13 Jan 2011 03:20:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jan 2011 03:20:09 -0000 Received: (qmail 70776 invoked by uid 500); 13 Jan 2011 03:20:08 -0000 Delivered-To: apmail-subversion-users-archive@subversion.apache.org Received: (qmail 70606 invoked by uid 500); 13 Jan 2011 03:20:06 -0000 Mailing-List: contact users-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@subversion.apache.org Received: (qmail 70598 invoked by uid 99); 13 Jan 2011 03:20:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jan 2011 03:20:06 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of qazwart@gmail.com designates 74.125.82.47 as permitted sender) Received: from [74.125.82.47] (HELO mail-ww0-f47.google.com) (74.125.82.47) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jan 2011 03:19:59 +0000 Received: by wwb39 with SMTP id 39so1503034wwb.16 for ; Wed, 12 Jan 2011 19:19:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=HU2iJKS6miW/RAJVfiaO5NUnCsEehjmD0x0RnwoKxMs=; b=vTgLdJJxWdfIUEGlk+BCFcR48m8Cf2SQzi6C97jN9QGwhvc0UE4NRNW7jpfeECoRp/ Bt2qQsxXO2RcbTcxuuBGoFYKPsZqrBIn/yzjo1f0HeDgb3mEdgVGe331H4v1ssACM0+i hElmKqw+mxZP5jsXn06pUJDcZWI4hdNR70+rs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=UsuKi4F3/P+4mfTLfMTmX7VjZNxxopLQzNAL1sn4KQwaUBmNB/yjtnJGdgjm7EcvAb p5LI70R6UGx1VA4dnKLvEJKfDVyaiLP36iB9TFdStgAASb5qAdsbV+J0X8+9tS4k8PF4 BzKHAmXwNf1MWT9RQIYKSDhn4xg1c7bYtCyR8= MIME-Version: 1.0 Received: by 10.216.30.81 with SMTP id j59mr1733945wea.39.1294888779233; Wed, 12 Jan 2011 19:19:39 -0800 (PST) Received: by 10.216.168.135 with HTTP; Wed, 12 Jan 2011 19:19:39 -0800 (PST) In-Reply-To: References: Date: Wed, 12 Jan 2011 22:19:39 -0500 Message-ID: Subject: Re: SVN Hooks to require log message, limit size and file type From: David Weintraub To: David Xie Cc: users@subversion.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Jan 11, 2011 at 8:46 PM, David Xie=A0=A0wrote: > > Hello, > > I am looking for a hook to require log message when commit. I succeded to= do it. > > At the same time, I want to limit size less than 10MB and forbid .zip .7z= .rar file type. > I found some hooks from internet, tried multi times but all failed. I cou= ld always > commit big than 10M files and zip files. I struggled two days but could n= ot resolve it. I have a pre-commit hook at=A0http://db.tt/H3o1i7S that will verify your log message is at least 10 characters, and will also verify that your files don't end in whatever suffixes you're trying to avoid. It doesn't do a size check though. Does your hook succeed in preventing files with your banned suffixes from being committed? Is your problem just the size of the files? What about comment length? Does your hook prevent people from writing commit messages shorter than 10 characters? After you calculate "filesize" add the following line: echo "File size for $f is $filesize" 1>&2 Then, make the last line in your hook "exit 1" instead of "exit 0". This will print out the file size of all the files you're attempting to commit, and then fail the hook since the hook always exits with a exit code of 1. When you attempt to commit, you should see a failed commit and a bunch of lines telling you the file size of each file. If not, you'll get a better idea what the problem might be. -- David Weintraub qazwart@gmail.com