Show More
@@ -3109,6 +3109,8 b' table = {' | |||||
3109 | "version": (version_, [], _('hg version')), |
|
3109 | "version": (version_, [], _('hg version')), | |
3110 | } |
|
3110 | } | |
3111 |
|
3111 | |||
|
3112 | extensions.commandtable = table | |||
|
3113 | ||||
3112 | norepo = ("clone init version help debugancestor debugcomplete debugdata" |
|
3114 | norepo = ("clone init version help debugancestor debugcomplete debugdata" | |
3113 | " debugindex debugindexdot debugdate debuginstall") |
|
3115 | " debugindex debugindexdot debugdate debuginstall") | |
3114 | optionalrepo = ("paths serve showconfig") |
|
3116 | optionalrepo = ("paths serve showconfig") |
@@ -6,10 +6,12 b'' | |||||
6 | # of the GNU General Public License, incorporated herein by reference. |
|
6 | # of the GNU General Public License, incorporated herein by reference. | |
7 |
|
7 | |||
8 | import imp, os |
|
8 | import imp, os | |
9 |
import |
|
9 | import util, sys | |
10 | from i18n import _ |
|
10 | from i18n import _ | |
11 |
|
11 | |||
12 | _extensions = {} |
|
12 | _extensions = {} | |
|
13 | commandtable = {} | |||
|
14 | setuphooks = [] | |||
13 |
|
15 | |||
14 | def find(name): |
|
16 | def find(name): | |
15 | '''return module with given extension name''' |
|
17 | '''return module with given extension name''' | |
@@ -54,13 +56,13 b' def load(ui, name, path):' | |||||
54 | uisetup(ui) |
|
56 | uisetup(ui) | |
55 | reposetup = getattr(mod, 'reposetup', None) |
|
57 | reposetup = getattr(mod, 'reposetup', None) | |
56 | if reposetup: |
|
58 | if reposetup: | |
57 |
|
|
59 | setuphooks.append(reposetup) | |
58 | cmdtable = getattr(mod, 'cmdtable', {}) |
|
60 | cmdtable = getattr(mod, 'cmdtable', {}) | |
59 |
overrides = [cmd for cmd in cmdtable if cmd in command |
|
61 | overrides = [cmd for cmd in cmdtable if cmd in commandtable] | |
60 | if overrides: |
|
62 | if overrides: | |
61 | ui.warn(_("extension '%s' overrides commands: %s\n") |
|
63 | ui.warn(_("extension '%s' overrides commands: %s\n") | |
62 | % (name, " ".join(overrides))) |
|
64 | % (name, " ".join(overrides))) | |
63 |
command |
|
65 | commandtable.update(cmdtable) | |
64 |
|
66 | |||
65 | def loadall(ui): |
|
67 | def loadall(ui): | |
66 | result = ui.configitems("extensions") |
|
68 | result = ui.configitems("extensions") |
@@ -10,7 +10,7 b' from node import *' | |||||
10 | from repo import * |
|
10 | from repo import * | |
11 | from i18n import _ |
|
11 | from i18n import _ | |
12 | import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo |
|
12 | import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo | |
13 | import errno, lock, os, shutil, util, cmdutil |
|
13 | import errno, lock, os, shutil, util, cmdutil, extensions | |
14 | import merge as _merge |
|
14 | import merge as _merge | |
15 | import verify as _verify |
|
15 | import verify as _verify | |
16 |
|
16 | |||
@@ -50,13 +50,11 b' def islocal(repo):' | |||||
50 | return False |
|
50 | return False | |
51 | return repo.local() |
|
51 | return repo.local() | |
52 |
|
52 | |||
53 | repo_setup_hooks = [] |
|
|||
54 |
|
||||
55 | def repository(ui, path='', create=False): |
|
53 | def repository(ui, path='', create=False): | |
56 | """return a repository object for the specified path""" |
|
54 | """return a repository object for the specified path""" | |
57 | repo = _lookup(path).instance(ui, path, create) |
|
55 | repo = _lookup(path).instance(ui, path, create) | |
58 | ui = getattr(repo, "ui", ui) |
|
56 | ui = getattr(repo, "ui", ui) | |
59 |
for hook in |
|
57 | for hook in extensions.setuphooks: | |
60 | hook(ui, repo) |
|
58 | hook(ui, repo) | |
61 | return repo |
|
59 | return repo | |
62 |
|
60 |
General Comments 0
You need to be logged in to leave comments.
Login now