Return-Path: X-Original-To: apmail-subversion-users-archive@minotaur.apache.org Delivered-To: apmail-subversion-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C76EB9614 for ; Fri, 15 Jun 2012 18:43:08 +0000 (UTC) Received: (qmail 70496 invoked by uid 500); 15 Jun 2012 18:43:08 -0000 Delivered-To: apmail-subversion-users-archive@subversion.apache.org Received: (qmail 70473 invoked by uid 500); 15 Jun 2012 18:43:08 -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 70466 invoked by uid 99); 15 Jun 2012 18:43:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2012 18:43:07 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [78.47.87.163] (HELO mx0.elegosoft.com) (78.47.87.163) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2012 18:42:58 +0000 Received: from localhost (localhost [127.0.0.1]) by mx0.elegosoft.com (Postfix) with ESMTP id CEA02DE10E; Fri, 15 Jun 2012 20:42:38 +0200 (CEST) Received: from mx0.elegosoft.com ([127.0.0.1]) by localhost (mx0.elegosoft.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gjGUA1acvRk5; Fri, 15 Jun 2012 20:42:38 +0200 (CEST) Received: from lp-shahaf.local (bzq-109-67-197-14.red.bezeqint.net [109.67.197.14]) by mx0.elegosoft.com (Postfix) with ESMTPSA id 1BDA1DE0C6; Fri, 15 Jun 2012 20:42:38 +0200 (CEST) Date: Fri, 15 Jun 2012 21:42:35 +0300 From: Daniel Shahaf To: Johan Corveleyn Cc: Vladimir Shun'kov , "Cooke, Mark" , Andy Levy , "users@subversion.apache.org" Subject: Re: Commit size Message-ID: <20120615184235.GK3526@lp-shahaf.local> References: <4F7A7621A511B945915EB16D655311D8126D10BDF7@GBOXFW99E01MSX.ww005.siemens.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Johan Corveleyn wrote on Wed, Jun 13, 2012 at 15:32:56 +0200: > On Wed, Jun 13, 2012 at 3:16 PM, Vladimir Shun'kov wrote: > > Would be enough have the number bytes of changes. I did disk usage in > > pre-commit hook and disk usage in post-commit hook and then calculated > > the difference. But I commited the new file with size 20Kb and size of > > commit I recieved only 5Kb due some svn compression I guess. > > In 1.7, there's a new svnlook subcommand: 'svnlook filesize'. This can > give you the filesize of any file (from a revision or a transaction), > without having to 'svnlook cat' it (i.e. more efficiently). > > Maybe you can use that directly, or use it to calculate the difference? > > Like, in the pre-commit hook: > > 1) 'svnlook changed -t $TXN $REPOS' to get the list of changes in this > transaction > > 2) For every changed (or added) file, do 'svnlook filesize -t $TXN $REPOS' > > 3) For changed files, compare them to 'svnlook filesize -r $YOUNGEST > $REPOS' where $YOUNGEST is the result of 'svnlook youngest $REPOS'. > > 4) Do some arithmetic on the result > $TXN may be based on a revision earlier than $YOUNGEST, and the file may have changed between that base revision and youngest. If that happens, the commit attempt will fail due to a conflict, but before that happens the logic above would make calculations based on the wrong information. I don't know if there is an svnlook API to print the base revision of a given txn... but I guess there should be. > HTH > -- > Johan