How to use the lastversion.LocalVersionSession.LocalVersionSession function in lastversion

To help you get started, we’ve selected a few lastversion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dvershinin / lastversion / lastversion / HolderFactory.py View on Github external
from .BitBucketRepoSession import BitBucketRepoSession
from .GitHubRepoSession import GitHubRepoSession
from .GitLabRepoSession import GitLabRepoSession
from .LocalVersionSession import LocalVersionSession
from .MercurialRepoSession import MercurialRepoSession
from .SourceForgeRepoSession import SourceForgeRepoSession


class HolderFactory:
    HOLDERS = {
        'github': GitHubRepoSession,
        'gitlab': GitLabRepoSession,
        'bitbucket': BitBucketRepoSession,
        'hg': MercurialRepoSession,
        'sf': SourceForgeRepoSession,
        'local': LocalVersionSession
    }

    @staticmethod
    # go through subclasses in order to find the one that is hodling a given project
    # repo is either complete URL or a name allowing to identify a single project
    def get_instance_for_repo(repo):
        holder_class = HolderFactory.HOLDERS['github']
        hostname = None
        known_repo = None
        for k, sc in HolderFactory.HOLDERS.items():
            known_repo = sc.is_official_for_repo(repo)
            if known_repo:
                holder_class = sc
                log.info('Using {} adapter'.format(k))
                break
            # TODO now easy multiple default hostnames per holder
github dvershinin / lastversion / lastversion / LocalVersionSession.py View on Github external
def __init__(self, repo, hostname):
        super(LocalVersionSession, self).__init__()
        self.repo = repo
        self.hostname = hostname