[PATCH] commands: possibly start a web browser during `hg serve` (BC)

Kevin Bullock kbullock+mercurial at ringworld.org
Mon Jul 18 11:43:58 EDT 2016


> On Jul 16, 2016, at 01:04, Anton Shestakov <engored at ya.ru> wrote:
> 
> 16.07.2016, 12:58, "Gregory Szorc" <gregory.szorc at gmail.com>:
>> While this change is backwards incompatible, I think it strikes the
>> right balance of behavior: we only open browsers if it appears a user
>> is typing `hg serve`. And, the escape hatch is simple for people
>> wanting the previous behavior: `hg serve --browser=` or set
>> "web.browser" to an empty string or "none."
>> 
>> If nothing else, this change will help users discover the built-in
>> HTML interface when running `hg serve` for the first time. I still
>> encounter Mercurial users who don't realize that `hg serve` starts
>> a browseable server (as opposed to a headless HTTP/protocol server).
>> Launching the browser automatically will show them that the local
>> server is more than a "listening at <URL>" message in their terminal.
> 
> I've been running 3 different browsers with different arguments and extensions on 3 different workspaces (Xfce) for a long time and found that to be great. Now, if Xfce could pick up my custom menu items or shortcuts (it can't) and make one of them the default browser, maaybe I could pick just one for every possible case of me running `hg serve` [1]. I assume it would still open the browser on the workspace where the terminal with `hg serve` is, and not on the workspace I want to keep that browser on. All of that would be fairly annoying. Thank you for reading my rant.
> 
> So I think that opening a browser on `hg serve` without arguments should be opt-in (require e.g. web.browser=default, or an argument to the command). How about alias.ui = serve --browser?

I agree, I think this is too much BC--but is a nice feature that we could straightforwardly create a new command for (`hg browse` maybe?). I also like the idea of adding a hint to the `hg serve` output that points people towards the browser.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list