Ivan Zhakov wrote:
> On Tue, Oct 6, 2009 at 10:00 PM, C. Michael Pilato <cmpilato_at_collab.net> wrote:
>> Ivan Zhakov wrote:
>>> On Tue, Oct 6, 2009 at 7:46 PM, C. Michael Pilato <cmpilato_at_collab.net> wrote:
>>>> Author: cmpilato
>>>> Date: Tue Oct 6 08:46:26 2009
>>>> New Revision: 39805
>>>>
>>>> Log:
>>>> Finish issue #3509 - Add support for 'svnlook filesize' subcommand.
>>>>
>>> Hi Michael,
>>>
>>> What do you think about 'svnlook size' subcommand which will show file
>>> size for files and directory size for directories?
>> What's the definition of a directory's size? Number of entries? And what's
>> the use-case?
>>
> Size of all files and subdirectories. Use case is similar to size
> files: quickly look and check size of directory in pre-commit hook for
> example.
Ah. So by "size of a directory" you mean "the sum of all files in and under
that directory", then.
I understand wanting to check the sizes of individual files in a pre-commit
hook, perhaps to validate against a policy that says you aren't allowed to
dump massive files into the VC system. And I'm aware of shops that have
policies against dumping massive *numbers* of files into a single directory
in their VC system. But I've never heard of any rules against keeping the
aggregate file size across a directory tree below some threshold. Though, I
suppose it could be used by Subversion hosting shops as a form of
per-project quota management.
*shrug*
If someone (like yourself) wants to make that change, that's fine with me.
I guess I could foresee someone wanting a few changes along these lines:
1. supporting multiple PATH_IN_REPOS arguments, and displaying the sum of
all the files listed:
$ svnlook filesize /path/to/repos /trunk/somefile.c /trunk/README
1457
2. supporting a --verbose (-v) flag which printed each file
on a line by itself and then a summary line:
$ svnlook filesize -v /path/to/repos /trunk/somefile.c /trunk/README
456 /trunk/somefile.c
1001 /trunk/README
--------------------------------------------------------------
1457 TOTAL
3. supporting the -R flag which causes the program to not complain
about directories, and instead recurse into them. (And which can
be used with -v and with multiple PATH_IN_REPOS arguments, too.)
$ svnlook filesize -R /path/to/repos /trunk
27146
$ svnlook filesize -R -v /path/to/repos /trunk
456 /trunk/somefile.c
1001 /trunk/README
25689 /trunk/ChangeLog
--------------------------------------------------------------
27146 TOTAL
--
C. Michael Pilato <cmpilato_at_collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2404248
Received on 2009-10-06 20:37:55 CEST