[PATCH 0 of 2] extensions, color: proper interdependency support

Brodie Rao dackze at gmail.com
Wed May 6 13:04:05 CDT 2009


After trying to rebase my color/record patch against crew tip, I
noticed that the color extension was updated to use extension.find()
as a means of extending mq. This approach fails when used against
record as hg loads record after color.

djc suggested I add a hook that extensions can use to modify other
extensions. I'm not that familiar with the hook code, and there are
some caveats, so I'd like some input on this.

- As it stands now, importing hook from extensions creates a circular
  import. djc suggested I move extensions.loadpath() into util. This
  only affects hook, but I did notice that it affects some 3rd party
  extensions I have (like attic). The patch incorporates this move.

- When running hg in verbose mode, a "calling hook" message is
  printed for every extension that is loaded whenever an extension
  adds this hook. I added an optional parameter "quiet" to hook.hook
  to suppress the note(). I'm not sure this is the right way to deal
  with this.

- I'm not sure if there should be a preloadext hook.

- I haven't added tests yet. If this seems like the right approach,
  I can look into doing that.


More information about the Mercurial-devel mailing list