(extensions) Is it possible to add hook dynamically under TortoiseHg?
Yuya Nishihara
yuya at tcha.org
Sat Apr 23 02:35:32 UTC 2016
On Sat, 23 Apr 2016 00:42:43 +0200, Marcin Kasperski wrote:
> > 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)
The wiki is misleading or doesn't mention why only pre/post-* hook can happen
to be set in uisetup(). (And that's why I said "in general".)
> > 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.
That is because TortoiseHg runs hg commands on command server. The changes
to "lui" are visible only to the first runcommand, which is "serve
--cmdserver pipe".
> > 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…)?
See mercurial/commandserver.py.
More information about the Mercurial
mailing list