(extensions) Is it possible to add hook dynamically under TortoiseHg?

Marcin Kasperski Marcin.Kasperski at mekk.waw.pl
Fri Apr 22 22:42:43 UTC 2016


> Well, the problem resides in hg. In general, you can't do ui.setconfig() in
> uisetup() and extsetup() 

https://www.mercurial-scm.org/wiki/WritingExtensions
(chapter 10.1)

> because the changes would be discarded soon.
> https://selenic.com/repo/hg/file/tip/mercurial/dispatch.py#l747

Under „raw” Mercurial everything works for me well, "hg tag" fires my
hook (tested over various Mercurials from 2.7 to 3.7). I won't pretend
that I understand how this ui hierarchy works, but for one reason or
another the hook is installed and triggered.

Only under TortoiseHg things go awry. And Tortoise's runcommand
is noticeably different than Mercurial's.

{ Having said all that, of course it would be great if Mercurial
  had some direct „install hook” API. Well, it doesn't }
 
> Perhaps you can use reposetup() and (no-dash) "pretag" hook.

It's too late. pretag works when changeset being tagged is already
decided upon, and my point is to make extra commit before tagging
and tag the resulting changeset.

Is there anything I could read or do to understand Tortoise's way
of command processing (apart from debugging, I give it some try
but that's a lot of partially async code…)?




More information about the Mercurial mailing list