[PATCH] lfs: add an experimental config to masquerade as git for the blob transfer

Augie Fackler raf at durin42.com
Wed Dec 13 09:48:50 EST 2017


> On Dec 13, 2017, at 09:47, Matt Harbison <mharbison72 at gmail.com> wrote:
> 
> 
> 
> On Dec 12, 2017, at 6:10 PM, Matt Harbison <mharbison72 at gmail.com <mailto:mharbison72 at gmail.com>> wrote:
> 
>> 
>>> On Dec 12, 2017, at 5:48 PM, Augie Fackler <raf at durin42.com <mailto:raf at durin42.com>> wrote:
>>> 
>>> 
>>>> On Dec 12, 2017, at 17:32, Matt Harbison <mharbison72 at gmail.com <mailto:mharbison72 at gmail.com>> wrote:
>>>> 
>>>> diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
>>>> --- a/hgext/lfs/blobstore.py
>>>> +++ b/hgext/lfs/blobstore.py
>>>> @@ -101,7 +101,10 @@ class _gitlfsremote(object):
>>>>       self.ui = ui
>>>>       baseurl, authinfo = url.authinfo()
>>>>       self.baseurl = baseurl.rstrip('/')
>>>> -        self.urlopener = urlmod.opener(ui, authinfo)
>>>> +        useragent = None
>>>> +        if repo.ui.configbool('experimental', 'lfs.git-user-agent'):
>>>> +            useragent = 'git/2.15.1'
>>> 
>>> what happens if you say something like 'git/2.15.1 (compatible; Mercurial %s)' % util.version()? Does that work?
>> 
>> I’ll give it a try tomorrow. I suspect it will be totally dependent on the particular server.
>> 
>> I wonder if in the future, the git version would ever be checked by 3rd party servers to know what features to support, or something like that.
> 
> That works, and so does “git/2.15.1 Mercurial/4.4+3-...”, like the example here:
> 
> https://tools.ietf.org/html/rfc7231#page-46 <https://tools.ietf.org/html/rfc7231#page-46>
> 
> I don’t have a particular preference.

I don't either. Do whichever of the versions that mentions hg that makes you happier?

(I think we should default to not advertising as git, so that people can file bugs? Or is that a bad UX?)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20171213/f1d3d5b3/attachment.html>


More information about the Mercurial-devel mailing list