def get_repo_revision():
    '''
    Returns mercurial revision string somelike `hg identify` does.

    Format is rev1:short-id1+;rev2:short-id2+

    Returns an empty string if anything goes wrong, such as missing
    .hg files or an unexpected format of internal HG files or no
    mercurial repository found.
    '''
    repopath = _findrepo()
    if not repopath:
        return ''
    # first try to use mercurial itself
    try:
        import mercurial.hg, mercurial.ui, mercurial.scmutil
        from mercurial.node import short as hexfunc
    except ImportError:
        pass
    else:
        ui = mercurial.ui.ui()
        repo = mercurial.hg.repository(ui, repopath)
        parents = repo[None].parents()
        changed = filter(None, repo.status()) and "+" or ""
        return ';'.join(['%s:%s%s' % (p.rev(), hexfunc(p.node()), changed)
                         for p in parents])

    # todo: mercurial not found, try to retrieve the information
    # ourselves
    return ''
Returns mercurial revision string somelike `hg identify` does.

    Format is rev1:short-id1+;rev2:short-id2+

    Returns an empty string if anything goes wrong, such as missing
    .hg files or an unexpected format of internal HG files or no
    mercurial repository found.