Beispiel #1
0
def isUrl(url):
    """
    Figures out whether the given string is a valid Git repository URL

    :param url: URL to the repository
    :type url: string
    """
    return Git.isUrl(url)
Beispiel #2
0
def isUrl(url):
    """
    Figures out whether the given string is a valid Git repository URL

    :param url: URL to the repository
    :type url: string
    """
    return Git.isUrl(url)
Beispiel #3
0
def getType(url):
    """
    Returns repository type of the given URL

    :param url: URL to the repository
    :type url: string
    """
    if Git.isUrl(url):
        return "git"
    else:
        return None
Beispiel #4
0
def getType(url):
    """
    Returns repository type of the given URL

    :param url: URL to the repository
    :type url: string
    """
    if Git.isUrl(url):
        return "git"
    else:
        return None
Beispiel #5
0
def update(url, version=None, path=None, update=True):
    """
    Clones the given repository URL (optionally with overriding/update features)

    :param url: URL to the repository
    :type url: string
    :param version: Version to clone
    :type url: string
    :param version: Destination path
    :type url: string
    :param version: Eneable/disable update functionality
    :type url: string
    """

    revision = None

    if Git.isUrl(url):
        version = Git.expandVersion(version)
        revision = Git.update(url, version, path, update)

    return revision
Beispiel #6
0
def update(url, version=None, path=None, update=True):
    """
    Clones the given repository URL (optionally with overriding/update features)

    :param url: URL to the repository
    :type url: string
    :param version: Version to clone
    :type url: string
    :param version: Destination path
    :type url: string
    :param version: Eneable/disable update functionality
    :type url: string
    """

    revision = None

    if Git.isUrl(url):
        version = Git.expandVersion(version)
        revision = Git.update(url, version, path, update)

    return revision
Beispiel #7
0
def getTargetFolder(url, version=None):
    """
    Returns the target folder name based on the URL and version using SHA1 checksums

    :param url: URL to the repository
    :type url: string
    :param version: Version to use
    :type url: string
    """
    
    if Git.isUrl(url):

        version = Git.expandVersion(version)

        folder = url[url.rindex("/")+1:]
        if folder.endswith(".git"):
            folder = folder[:-4]

        identifier = "%s@%s" % (url, version)
        version = version[version.rindex("/")+1:]

    hash = hashlib.sha1(identifier.encode("utf-8")).hexdigest()
    return "%s-%s-%s" % (folder, version, hash)
Beispiel #8
0
def getTargetFolder(url, version=None):
    """
    Returns the target folder name based on the URL and version using SHA1 checksums

    :param url: URL to the repository
    :type url: string
    :param version: Version to use
    :type url: string
    """
    
    if Git.isUrl(url):

        version = Git.expandVersion(version)

        folder = url[url.rindex("/")+1:]
        if folder.endswith(".git"):
            folder = folder[:-4]

        identifier = "%s@%s" % (url, version)
        version = version[version.rindex("/")+1:]

    hash = hashlib.sha1(identifier.encode("utf-8")).hexdigest()
    return "%s-%s-%s" % (folder, version, hash)