How to use the dulwich.client.HttpGitClient function in dulwich

To help you get started, we’ve selected a few dulwich 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 wuye9036 / SalviaRenderer / toolkit / hg-git / hggit / git_handler.py View on Github external
return transport(host, thin_packs=False, port=port), path

        httpclient = getattr(client, 'HttpGitClient', None)

        if uri.startswith('git+http://') or uri.startswith('git+https://'):
            uri = uri[4:]

        if uri.startswith('http://') or uri.startswith('https://'):
            if not httpclient:
                raise RepoError('git via HTTP requires dulwich 0.8.1 or later')
            else:
                auth_handler = urllib2.HTTPBasicAuthHandler(AuthManager(self.ui))
                opener = urllib2.build_opener(auth_handler)
                try:
                    return client.HttpGitClient(uri, opener=opener, thin_packs=False), uri
                except TypeError as e:
                    if e.message.find("unexpected keyword argument 'opener'") >= 0:
                        # using a version of dulwich that doesn't support
                        # http(s) authentication -- try without authentication
                        return client.HttpGitClient(uri, thin_packs=False), uri
                    else:
                        raise

        # if its not git or git+ssh, try a local url..
        return client.SubprocessGitClient(thin_packs=False), uri
github facebookexperimental / eden / eden / scm / edenscm / hgext / hggit / git_handler.py View on Github external
client.port = port

            return transport(host, port=port), path

        if uri.startswith("git+http://") or uri.startswith("git+https://"):
            uri = uri[4:]

        if uri.startswith("http://") or uri.startswith("https://"):
            pmgr = compat.passwordmgr(self.ui)
            auth = hgutil.urlreq.HTTPBasicAuthHandler(pmgr)

            opener = hgutil.urlreq.build_opener(auth)
            ua = "git/20x6 (hg-git ; uses dulwich and hg ; like git-core)"
            opener.addheaders = [("User-Agent", ua)]
            try:
                return client.HttpGitClient(uri, opener=opener), uri
            except TypeError as e:
                if e.message.find("unexpected keyword argument 'opener'") >= 0:
                    # Dulwich 0.9.4, which is the latest version that ships
                    # with Ubuntu 14.04, doesn't support the 'opener' keyword.
                    # Try without authentication.
                    return client.HttpGitClient(uri), uri
                else:
                    raise

        # if its not git or git+ssh, try a local url..
        return client.SubprocessGitClient(), uri
github wuye9036 / SalviaRenderer / toolkit / hg-git / hggit / git_handler.py View on Github external
if uri.startswith('git+http://') or uri.startswith('git+https://'):
            uri = uri[4:]

        if uri.startswith('http://') or uri.startswith('https://'):
            if not httpclient:
                raise RepoError('git via HTTP requires dulwich 0.8.1 or later')
            else:
                auth_handler = urllib2.HTTPBasicAuthHandler(AuthManager(self.ui))
                opener = urllib2.build_opener(auth_handler)
                try:
                    return client.HttpGitClient(uri, opener=opener, thin_packs=False), uri
                except TypeError as e:
                    if e.message.find("unexpected keyword argument 'opener'") >= 0:
                        # using a version of dulwich that doesn't support
                        # http(s) authentication -- try without authentication
                        return client.HttpGitClient(uri, thin_packs=False), uri
                    else:
                        raise

        # if its not git or git+ssh, try a local url..
        return client.SubprocessGitClient(thin_packs=False), uri
github dcos / dcos-e2e / admin / release.py View on Github external
release_message=release_message,
        type='commit',
        object=repository.get_commits()[0].sha,
        draft=False,
    )

    # The artifacts we build must be built from the tag we just created.
    # This tag is created remotely on GitHub using the GitHub HTTP API.
    #
    # We fetch all tags from GitHub and set our local HEAD to the latest master
    # from GitHub.
    #
    # One symptom of this is that ``dcos-docker --version`` from the
    # PyInstaller binaries shows the correct version.
    local_repository = Repo('.')
    client = HttpGitClient(repository.owner.html_url)
    remote_refs = client.fetch(repository.name + '.git', local_repository)

    # Update the local tags and references with the remote ones.
    for key, value in remote_refs.items():
        local_repository.refs[key] = value

    # Advance local HEAD to remote master HEAD.
    local_repository[b'HEAD'] = remote_refs[b'refs/heads/master']

    # We need to make the artifacts just after creating a tag so that the
    # --version output is exactly the one of the tag.
    # No tag exists when the GitHub release is a draft.
    # This means that temporarily we have a release without binaries.
    linux_artifacts = make_linux_binaries(repo_root=Path('.'))
    for artifact_path in linux_artifacts:
        github_release.upload_asset(