<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 14, 2016 at 10:48 AM, Augie Fackler <span dir="ltr"><<a href="mailto:raf@durin42.com" target="_blank">raf@durin42.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Jul 13, 2016 at 10:18:26PM -0700, Gregory Szorc wrote:<br>
</span><span class="">> # HG changeset patch<br>
> # User Gregory Szorc <<a href="mailto:gregory.szorc@gmail.com">gregory.szorc@gmail.com</a>><br>
> # Date 1468473406 25200<br>
> #      Wed Jul 13 22:16:46 2016 -0700<br>
> # Node ID 6ad61d5001b1fbfebf317d0557f158d4b34a0772<br>
> # Parent  52433f89f816e21ca992ac8c4a41cba0345f1b73<br>
> url: add distribution and version to user-agent request header (BC)<br>
<br>
</span>It's actually intentional that we don't advertise hg version in either<br>
direction to my recollection.</blockquote><div><br></div><div>Do you know why?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That said, I have been meaning to write<br>
a patch like this (but with it behind a config knob) so that big<br>
companies can track how many versions of hg are in use. Can you do a<br>
v2 with this off by default behind a config knob?<br></blockquote><div><br></div><div>I /can/. But I'm not thrilled about making it optional because open source projects (like Mozilla) don't have a good way of force turning it on :/<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5"><br>
><br>
> As a server operator, I've always wanted to know what Mercurial<br>
> version clients are running. Unfortunately, there is no easy<br>
> way to discern this today: the best you can do is sniff capabilities<br>
> from getbundle commands and those aren't updated frequently enough<br>
> to tell you anything that interesting.<br>
><br>
> This patch adds the distribution name and version to the user-agent<br>
> HTTP request header. We choose "Mercurial" for the distribution<br>
> name because that seems appropriate. The version string comes<br>
> from __version__. It should have no spaces and should therefore be<br>
> safe to include outside of quotes, parenthesis, etc.<br>
><br>
> Flagging the patch as BC so it shows up in release notes. This<br>
> change should be backwards compatible. But I'm sure there is a server<br>
> operator somewhere filtering on the existing user-agent request<br>
> header. So I want to make noise about this change.<br>
><br>
> diff --git a/mercurial/url.py b/mercurial/url.py<br>
> --- a/mercurial/url.py<br>
> +++ b/mercurial/url.py<br>
> @@ -500,18 +500,22 @@ def opener(ui, authinfo=None):<br>
>          ui.debug('http auth: user %s, password %s\n' %<br>
>                   (user, passwd and '*' * len(passwd) or 'not set'))<br>
><br>
>      handlers.extend((httpbasicauthhandler(passmgr),<br>
>                       httpdigestauthhandler(passmgr)))<br>
>      handlers.extend([h(ui, passmgr) for h in handlerfuncs])<br>
>      opener = urlreq.buildopener(*handlers)<br>
><br>
> -    # 1.0 here is the _protocol_ version<br>
> -    opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]<br>
> +    opener.addheaders = [('User-agent',<br>
> +                          # 1.0 here is the _protocol_ version<br>
> +                          # "Mercurial/%s" identifies the distribution name<br>
> +                          # and version. Other implementations of the client<br>
> +                          # should choose a different name.<br>
> +                          'mercurial/proto-1.0 Mercurial/%s' % util.version())]<br>
>      opener.addheaders.append(('Accept', 'application/mercurial-0.1'))<br>
>      return opener<br>
><br>
>  def open(ui, url_, data=None):<br>
>      u = util.url(url_)<br>
>      if u.scheme:<br>
>          u.scheme = u.scheme.lower()<br>
>          url_, authinfo = u.authinfo()<br>
</div></div>> _______________________________________________<br>
> Mercurial-devel mailing list<br>
> <a href="mailto:Mercurial-devel@mercurial-scm.org">Mercurial-devel@mercurial-scm.org</a><br>
> <a href="https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel" rel="noreferrer" target="_blank">https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel</a><br>
</blockquote></div><br></div></div>