view tools/common.sh @ 1426:6ad1755f9e3f

wrappers: remove "svn.meta = meta" in pull This is part of a bigger plan to prevent a fd leak because SqliteRevMap.db never gets garbage collected. The "svn.meta = meta" adds another reference to the SVNMeta object and is never used. I changed it to "svn.meta = 1" and tests are passing so it looks safe to remove.
author Jun Wu <quark@fb.com>
date Fri, 27 May 2016 11:46:58 +0100
parents 5071b8511572
children
line wrap: on
line source

function verify_current_revision()
{
    /bin/rm -rf *
    exportcmd="svn export `hg svn info 2> /dev/null | grep '^URL: ' | sed 's/URL: //'`@`hg svn info | grep ^Revision | sed 's/.*: //;s/ .*//'` . --force"
    `echo $exportcmd` > /dev/null
    x=$?
    if [[ "$x" != "0" ]] ; then
        echo $exportcmd
        echo 'export failed!'
        return 255
    fi
    if [[ "`hg st | wc -l | python -c 'import sys; print sys.stdin.read().strip()'`" == "0" ]] ; then
        return 0
    else
        if [[ $1 != "keep" ]] ; then
            revert_all_files
        fi
        return 1
    fi
}

function revert_all_files()
{
    hg revert --all
    hg purge
}