How to use the lastversion.BitBucketRepoSession.BitBucketRepoSession 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 / BitBucketRepoSession.py View on Github external
def __init__(self, repo, hostname):
        super(BitBucketRepoSession, self).__init__()
        self.hostname = hostname
        if not self.hostname:
            self.hostname = self.DEFAULT_HOSTNAME
        self.repo = repo
github dvershinin / lastversion / lastversion / HolderFactory.py View on Github external
import logging as log  # for verbose output
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