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