Esempio n. 1
0
    def __init__(self, ui, url):
        self.ui = ui
        self._metrics = {
            "lfs_download_size": 0,
            "lfs_download_time": 0,
            "lfs_upload_size": 0,
            "lfs_upload_time": 0,
        }
        self._timestamp = {
            "latest_download_timestamp": 0,
            "latest_upload_timestamp": 0
        }
        baseurl, authinfo = url.authinfo()
        self.baseurl = baseurl.rstrip("/")
        useragent = ui.config("experimental", "lfs.user-agent")
        if not useragent:
            useragent = "mercurial/%s git/2.15.1" % util.version()
        try:
            self.urlopener = urlmod.opener(ui, authinfo, useragent)
        except TypeError:
            # System hg can have old version of opener() which does not require
            # user agent.
            self.urlopener = urlmod.opener(ui, authinfo)

        self.retry = ui.configint("lfs", "retry")
Esempio n. 2
0
    def __init__(self, ui, token=None):
        self.ui = ui
        self.token = token if token != ccutil.FAKE_TOKEN else None
        self.debugrequests = ui.config("commitcloud", "debugrequests")
        self.url = ui.config("commitcloud", "url")
        self._sockettimeout = DEFAULT_TIMEOUT
        self.user_agent = "EdenSCM {}".format(util.version())
        self._unix_socket_proxy = (ui.config(
            "auth_proxy", "unix_socket_path") if ui.config(
                "auth_proxy", "commitcloud_use_uds") else None)

        if self._unix_socket_proxy:
            self.user_agent += "+x2pagentd"

        if not self.url:
            raise ccerror.ConfigurationError(
                self.ui, _("'commitcloud.url' is required"))

        self._setupconnection()