You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Phil Pinkerton <pc...@gmail.com> on 2009/09/25 18:32:47 UTC

svnlook cat -t $TXN $REPO broken ?

Seems that trying to create a pre-commit hook script that limits the size of
a file to be committed is not an easy task.

svnlook has been recommended but I have yet to see it work properly the "-t"
option does not seem to find the transaction.

svnlook cat -t $TXN $REPO   always returns an error

# Check file size. do not allow Access files greater than 1MB.
    REPOS=$1
    TXN=$2
    SVNLOOK=/svn/bin/svnlook

    # get a list of all the files changed
    $SVNLOOK changed -t "$TXN" "$REPOS" | while read type file
    do
        # skip all the files unless they end in .mdb
        [ ${file##*.} != "mdb" ] && continue   #Skip unless a .mdb suffix
        # I cat out the file and then count the characters.
        # If it is greater than 1mb, I put it in my error array.
        # Is there a better way to get the size of a file w/ svnlook?
                       if [ $($SVNLOOK cat -t "$TXN"  "$REPOS" $file | wc
-c) -ge "1000000" ]
error here ??     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        then
           $error["$file"]=""$file: We can't commit Access databases larger
than 1mb"
        fi
    done

-- 
" The fundamental principle here is that the justification for a physical
concept lies exclusively in its clear and unambiguous relation to the facts
that it can be experienced"   AE

Please Feed and Educate the Children... it's the least any of us can do.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2400352

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: svnlook cat -t $TXN $REPO broken ?

Posted by Mark Eichin <ei...@gmail.com>.
I do almost exactly that, with


if $SVNLOOK changed -t "$TXN" "$REPOS" | grep --quiet /Jamfile ; then
    echo found jamfile >&2
    JAMPATH=$($SVNLOOK changed -t "$TXN" "$REPOS"  | cut -c5- | egrep
'Jamfile$')
     $SVNLOOK cat "$REPOS" -t "$TXN" "$JAMPATH" > $tmpdir/Jamfile

(leaving out the tmpdir bits and the rest - we actually have a
(product-specific) "jamlint" script we check out at the same time, and
if it fails, the commit fails...)  So the obvious question is *what*
error are you getting?  You didn't say in your post...

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2400396

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].