List of Versions of this repository.

        :param version: Version index.
        :param rev: Commit sha or ref.

        :return: List of Version objects matching params.

def versions(self, version=None):
        """
        List of Versions of this repository.

        :param version: Version index.
        :param rev: Commit sha or ref.

        :return: List of Version objects matching params.
        """
        try:
            versions = [Version(self, c) for c in self._commits()]
        except Exception, e:
            log.debug('No versions exist')
            return []
        if version is not None and versions:
            try:
                versions = versions[version]
            except IndexError:
                raise VersionError('Version %s does not exist' % version)
        return versions