view tools/common.sh @ 1456:77da55e0baa4

externals: support peg revisions in URLs I saw this some time ago -- according to the Subversion documentation peg revisions this is quite valid. Not entirely sure how to test this... (While at it, I raised our externals-related logging from debug to verbose as it's vaguely meaningful to users.) http://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 22 Apr 2014 15:40:39 +0200
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
}