view tools/common.sh @ 628:4375d37fea1e

svnrepo: fix issue 187: ignore pushable bookmarks in hg 1.6 Mercurial 1.6 introduces two new methods for repo subclasses -- pushkey and listkeys -- to support pushing/pulling bookmarks between hg repositories. (See mpm's blog post http://www.selenic.com/blog/?p=644 for details.) Unfortunately, these are only defined in the subclasses, and not in the repo base class. Perhaps the bookmarks extension should also be checking the repo for pushkeys capability by calling repo.capable('pushkey') to check. It doesn't. In the meantime, we can implement these ourselves. svnrepo should declare these methods since it is derived directly from repo. They do nothing -- listkeys merely returns an empty dictionary; pushkey returns False; this is the behaviour of httprepo or sshrepo when the remote end is running an earlier version of Mercurial. svnlocalrepo should not declare these methods since it derives from a subclass of localrepo, which already will have them, unless some other badly behaved extensions are doing something intensely weird.
author James McKay <code@jamesmckay.net>
date Sun, 04 Jul 2010 18:21:20 +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
}