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
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)