[PATCH] commands: possibly start a web browser during `hg serve` (BC)
pierre-yves.david at ens-lyon.org
Mon Jul 18 19:59:03 EDT 2016
On 07/16/2016 06:57 AM, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1468645039 25200
> # Fri Jul 15 21:57:19 2016 -0700
> # Node ID d9f80be11783508272240020c29ffd36529de53e
> # Parent 1c22400db72de4bbeb992fde534c0abbe1367b03
> commands: possibly start a web browser during `hg serve` (BC)
> When D. Richard Hipp visited the Mozilla office several months ago
> and was showing me all the awesomeness in his Fossil VCS, one of the
> features that stood out to me was `fossil ui` starting a fully-featured
> HTTP/HTML server including the web browser. It was so... elegant
> to just type a command and get a web browser pointed to a local
> HTTP server where you could interact with your VCS.
> From my own experience, when I run `hg serve` from an interactive
> terminal I open a web browser 95% of the time. The other 5% of the
> time I start the server so I can point another Mercurial client at it.
> `hg serve` isn't currently optimized for my use case because I have
> to run `hg serve` then copy or type a URL into my browser. What a waste
> of time!
> This patch changes the behavior of `hg serve` to automatically start
> a web browser if a) the terminal is interactive and we're not running
> a background daemon or server for specialized clients b) the --browser
> argument explicitly requests we start a browser.
> 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."
I'm not super enthousiastic about making this the default either. pydoc
have '-g' flag to pop up a "graphical interface" which is actually just
the browser, I think a short flag would be good. Alternativement we
could make `hg view` generic and have a browser option for it.
More information about the Mercurial-devel