(extensions) Summary of dynamic-hooks-under-TortoiseHg problem

Marcin Kasperski Marcin.Kasperski at mekk.waw.pl
Sat Apr 30 10:56:12 UTC 2016


To summarize the issue: in my opinion there is something wrong in THG
current way of doing things (albeit not necessarily it is possible to
solve purely on Thg level), and mayhaps it is about definining command
server responsibilities.

TortoiseHg calls extensions.loadall, this way asking extensions to
configure theirselves, then throws away any ui.config settings they
registered, including possible new entries in ui.config("hooks").
Mercurial command server is never notified about those settings, so of
course can't run those hooks (not to mention it works in different
process so passing code object is not an option even if thg wanted to).

As I think, either-or:

- either it is Mercurial command server, who is responsible for
  extension handling.  Then Tortoise shouldn't need to call
  extensions.loadall and leave the problem completely to the command
  server

  (for some reason it doesn't happen, I don't understand the code well
  enough to say whether it is because of command server itself, or the
  way thg starts it)

- or command server is to be „dummy lowlevel repo processor”, then GUI
  client which uses it as backend must take various responsibilities,
  including satisfying extensions protocol[*]. That means also hooks
  processing.

  (which may take various forms, from spawning hooks directly from thg, 
  to notifying cmdserver about hooks somehow)

For me it's not quite clear where cmdserver stays here (is it expected
to be „smart” or „lowlevel”)? But if it is to be smart, why thg calls
extensions.loadall?

As we stay now, looks like there is no way extension could dynamically
enable hook and get it working under thg (except asking user to manually
add hooks to ~/.hgrc), and it would be nice to resolve it, if possible
(distributing useful hooks as extensions is very nice way to ease hook
installation, especially for less advanced uses, and less advanced users
do more things in THG).

[*] As protocol I understand possibilities described on 
https://www.mercurial-scm.org/wiki/WritingExtensions#Wrap_up:_what_belongs_where.3F

PS I am very grateful for TortoiseHg…




More information about the Mercurial mailing list