Mercurial > hg-stable
changeset 35444:e333d27514b0
lfs: add an experimental config to override User-Agent for the blob transfer
This will allow developers to test against various server implementations. I
didn't put it under [devel] because it's possible that some user needs to use it
in the field.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 12 Dec 2017 15:16:02 -0500 |
parents | e7bb5fc4570c |
children | 98cc121099fe |
files | hgext/lfs/__init__.py hgext/lfs/blobstore.py |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/lfs/__init__.py Thu Dec 14 13:04:08 2017 -0500 +++ b/hgext/lfs/__init__.py Tue Dec 12 15:16:02 2017 -0500 @@ -64,6 +64,10 @@ configtable = {} configitem = registrar.configitem(configtable) +configitem('experimental', 'lfs.user-agent', + default=None, +) + configitem('lfs', 'url', default=configitem.dynamicdefault, )
--- a/hgext/lfs/blobstore.py Thu Dec 14 13:04:08 2017 -0500 +++ b/hgext/lfs/blobstore.py Tue Dec 12 15:16:02 2017 -0500 @@ -125,7 +125,9 @@ self.ui = ui baseurl, authinfo = url.authinfo() self.baseurl = baseurl.rstrip('/') - useragent = 'mercurial/%s git/2.15.1' % util.version() + useragent = repo.ui.config('experimental', 'lfs.user-agent') + if not useragent: + useragent = 'mercurial/%s git/2.15.1' % util.version() self.urlopener = urlmod.opener(ui, authinfo, useragent) self.retry = ui.configint('lfs', 'retry')