On Sun, Aug 8, 2010 at 9:25 AM, Yuya Nishihara <[email protected]> wrote: > Kurt Granroth wrote: >> On 08/01/2010 09:33 AM, Yuya Nishihara wrote: >> > Kurt Granroth wrote: >> >> The problem is that the hooks are attached to the "wrong" UI object. >> >> >> >> Okay, so hgtk.run() calls 'extension.loadall(ui)'. This is the function >> >> that calls the extensions' uisetup()... and this is where the necessary >> >> hook is setup so that hgeol is called during the update. So far, so good. >> > >> > I don't read full story yet, but Mercurial also calls extensions.loadall() >> > with lui, which is copy of ui. (see dispatch.py:_dispatch().) >> > It means preupdate.eol hook doesn't take effect in most cases. >> > >> > in-hg-repo% hg update # doesn't call eol.preupdate() >> > out-hg-repo% hg clone foo bar # calls eol.preupdate() >> > in-hg-repo% hg clone . ../bar # doesn't call eol.preupdate() >> > >> > It's only effective for clone only when you're outside ouf repository. >> >> I got almost exactly the *opposite* results of your test, in my earlier >> testing. That is, eol.preupdate() ran with 'hg update' but did not run >> with 'hg clone'. >> >> Actually, to be a bit more precise: hg clone *did* appear to work when >> the repositories were local (file://) but did not when the source repo >> was remote (ssh:// or http://). >> >> I don't think calling extensions.loadall() will do anything useful. The >> core extensions code uses a few global variables to ensure that hooks >> are only loaded once. > > I cannot figure out what makes difference. > Here's my understanding: > > uisetup() is called only by extensions.loadall(), and where calling > extensions.loadall() are: > % grep loadall *.py > dispatch.py: extensions.loadall(lui) > dispatch.py: # (uisetup and extsetup are handled in extensions.loadall) > extensions.py:def loadall(ui): > localrepo.py: extensions.loadall(self.ui) > > * If current directory is inside repo, _dispatch() copies ui to lui to load > local .hg/hgrc; then calls extensions.loadall(lui). > * If source repo of 'hg clone' is local, localrepository() will load its > .hg/hgrc followed by extensions.loadall(self.ui). Here self.ui is copy > of self.baseui.
I could see this being a problem if the eol extension is only enabled in the source repository .hg/hgrc file. TortoiseHg does not look there for extensions to enable. -- Steve Borho ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Tortoisehg-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tortoisehg-discuss

