def getvfs(repo):
    """Return appropriate object to access files under .hg
    """
    vfs = getattr(repo, 'vfs', None)
    if vfs:
        return vfs
    else:
        return getattr(repo, 'opener')
