Draft: dispatch: ignore RequirementError when starting command server (issue6606)

Per issue 6606, attempting to start a new command server fails when the hg serve command is run from within a repo with unknown requirements.

The issue is that hg serve is defined with optionalrepo=True because the command has been overloaded to serve two purposes: to serve the contents of a repo via an HTTP server, or to start a chg command server daemon to run arbitrary hg commands. In the latter case, the repo (if any) loaded when the server starts up is ignored entirely, and instead repos are loaded as needed by incoming requests (or not at all in the case of norepo commands). For this reason, it seems like hg serve should act like a norepo command when used to start a command server.

Since loading the repo initially happens in dispatch.py during startup, I ended up using a fairly crude heuristic to determine whether to ignore the RequirementError. I'm not sure if there's a better way of doing this, so suggestions are welcome.

Merge request reports