Show More
@@ -0,0 +1,104 b'' | |||||
|
1 | # demandimport.py - global demand-loading of modules for Mercurial | |||
|
2 | # | |||
|
3 | # Copyright 2006 Matt Mackall <mpm@selenic.com> | |||
|
4 | # | |||
|
5 | # This software may be used and distributed according to the terms | |||
|
6 | # of the GNU General Public License, incorporated herein by reference. | |||
|
7 | ||||
|
8 | ''' | |||
|
9 | demandimport - automatic demandloading of modules | |||
|
10 | ||||
|
11 | To enable this module, do: | |||
|
12 | ||||
|
13 | import demandimport; demandimport.enable() | |||
|
14 | ||||
|
15 | Imports of the following forms will be demand-loaded: | |||
|
16 | ||||
|
17 | import a, b.c | |||
|
18 | import a.b as c | |||
|
19 | from a import b,c # a will be loaded immediately | |||
|
20 | ||||
|
21 | These imports will not be delayed: | |||
|
22 | ||||
|
23 | from a import * | |||
|
24 | b = __import__(a) | |||
|
25 | ''' | |||
|
26 | ||||
|
27 | _origimport = __import__ | |||
|
28 | ||||
|
29 | class _demandmod(object): | |||
|
30 | """module demand-loader and proxy""" | |||
|
31 | def __init__(self, name, globals, locals): | |||
|
32 | if '.' in name: | |||
|
33 | head, rest = name.split('.', 1) | |||
|
34 | after = [rest] | |||
|
35 | else: | |||
|
36 | head = name | |||
|
37 | after = [] | |||
|
38 | self.__dict__["_data"] = (head, globals, locals, after) | |||
|
39 | self.__dict__["_module"] = None | |||
|
40 | def _extend(self, name): | |||
|
41 | """add to the list of submodules to load""" | |||
|
42 | self._data[3].append(name) | |||
|
43 | def _load(self): | |||
|
44 | if not self._module: | |||
|
45 | head, globals, locals, after = self._data | |||
|
46 | mod = _origimport(head, globals, locals) | |||
|
47 | # load submodules | |||
|
48 | for x in after: | |||
|
49 | hx = x | |||
|
50 | if '.' in x: | |||
|
51 | hx = x.split('.')[0] | |||
|
52 | if not hasattr(mod, hx): | |||
|
53 | setattr(mod, hx, _demandmod(x, mod.__dict__, mod.__dict__)) | |||
|
54 | # are we in the locals dictionary still? | |||
|
55 | if locals and locals.get(head) == self: | |||
|
56 | locals[head] = mod | |||
|
57 | self.__dict__["_module"] = mod | |||
|
58 | def __repr__(self): | |||
|
59 | return "<unloaded module '%s'>" % self._data[0] | |||
|
60 | def __call__(self, *args, **kwargs): | |||
|
61 | raise TypeError("'unloaded module' object is not callable") | |||
|
62 | def __getattr__(self, attr): | |||
|
63 | self._load() | |||
|
64 | return getattr(self._module, attr) | |||
|
65 | def __setattr__(self, attr, val): | |||
|
66 | self._load() | |||
|
67 | setattr(self._module, attr, val) | |||
|
68 | ||||
|
69 | def _demandimport(name, globals=None, locals=None, fromlist=None): | |||
|
70 | if not locals or name in ignore or fromlist == ('*',): | |||
|
71 | # these cases we can't really delay | |||
|
72 | return _origimport(name, globals, locals, fromlist) | |||
|
73 | elif not fromlist: | |||
|
74 | # import a [as b] | |||
|
75 | if '.' in name: # a.b | |||
|
76 | base, rest = name.split('.', 1) | |||
|
77 | # if a is already demand-loaded, add b to its submodule list | |||
|
78 | if base in locals: | |||
|
79 | if isinstance(locals[base], _demandmod): | |||
|
80 | locals[base]._extend(rest) | |||
|
81 | return locals[base] | |||
|
82 | return _demandmod(name, globals, locals) | |||
|
83 | else: | |||
|
84 | # from a import b,c,d | |||
|
85 | mod = _origimport(name, globals, locals) | |||
|
86 | # recurse down the module chain | |||
|
87 | for comp in name.split('.')[1:]: | |||
|
88 | mod = getattr(mod, comp) | |||
|
89 | for x in fromlist: | |||
|
90 | # set requested submodules for demand load | |||
|
91 | if not(hasattr(mod, x)): | |||
|
92 | setattr(mod, x, _demandmod(x, mod.__dict__, mod.__dict__)) | |||
|
93 | return mod | |||
|
94 | ||||
|
95 | ignore = [] | |||
|
96 | ||||
|
97 | def enable(): | |||
|
98 | "enable global demand-loading of modules" | |||
|
99 | __builtins__["__import__"] = _demandimport | |||
|
100 | ||||
|
101 | def disable(): | |||
|
102 | "disable global demand-loading of modules" | |||
|
103 | __builtins__["__import__"] = _origimport | |||
|
104 |
@@ -11,10 +11,9 b'' | |||||
11 | # |
|
11 | # | |
12 | # <alias email> <actual email> |
|
12 | # <alias email> <actual email> | |
13 |
|
13 | |||
14 | from mercurial.demandload import * |
|
14 | import time, sys, signal, os | |
15 | from mercurial.i18n import gettext as _ |
|
15 | from mercurial.i18n import gettext as _ | |
16 | demandload(globals(), 'time sys signal os') |
|
16 | from mercurial import hg, mdiff, cmdutil, ui, util, templater, node | |
17 | demandload(globals(), 'mercurial:hg,mdiff,fancyopts,cmdutil,ui,util,templater,node') |
|
|||
18 |
|
17 | |||
19 | def __gather(ui, repo, node1, node2): |
|
18 | def __gather(ui, repo, node1, node2): | |
20 | def dirtywork(f, mmap1, mmap2): |
|
19 | def dirtywork(f, mmap1, mmap2): |
@@ -7,6 +7,5 b'' | |||||
7 | # This software may be used and distributed according to the terms |
|
7 | # This software may be used and distributed according to the terms | |
8 | # of the GNU General Public License, incorporated herein by reference. |
|
8 | # of the GNU General Public License, incorporated herein by reference. | |
9 |
|
9 | |||
10 |
|
|
10 | import mercurial.commands | |
11 |
|
11 | mercurial.commands.run() | ||
12 | commands.run() |
|
@@ -45,10 +45,10 b'' | |||||
45 | # glob pattern = user4, user5 |
|
45 | # glob pattern = user4, user5 | |
46 | # ** = user6 |
|
46 | # ** = user6 | |
47 |
|
47 | |||
48 | from mercurial.demandload import * |
|
|||
49 | from mercurial.i18n import gettext as _ |
|
48 | from mercurial.i18n import gettext as _ | |
50 | from mercurial.node import * |
|
49 | from mercurial.node import * | |
51 | demandload(globals(), 'getpass mercurial:util') |
|
50 | from mercurial import util | |
|
51 | import getpass | |||
52 |
|
52 | |||
53 | class checker(object): |
|
53 | class checker(object): | |
54 | '''acl checker.''' |
|
54 | '''acl checker.''' |
@@ -52,10 +52,10 b'' | |||||
52 | # [usermap] |
|
52 | # [usermap] | |
53 | # committer_email = bugzilla_user_name |
|
53 | # committer_email = bugzilla_user_name | |
54 |
|
54 | |||
55 | from mercurial.demandload import * |
|
|||
56 | from mercurial.i18n import gettext as _ |
|
55 | from mercurial.i18n import gettext as _ | |
57 | from mercurial.node import * |
|
56 | from mercurial.node import * | |
58 | demandload(globals(), 'mercurial:cmdutil,templater,util os re time') |
|
57 | from mercurial import cmdutil, templater, util | |
|
58 | import os, re, time | |||
59 |
|
59 | |||
60 | MySQLdb = None |
|
60 | MySQLdb = None | |
61 |
|
61 |
@@ -48,10 +48,10 b'' | |||||
48 | # needed files, so running the external diff program will actually be |
|
48 | # needed files, so running the external diff program will actually be | |
49 | # pretty fast (at least faster than having to compare the entire tree). |
|
49 | # pretty fast (at least faster than having to compare the entire tree). | |
50 |
|
50 | |||
51 | from mercurial.demandload import demandload |
|
|||
52 | from mercurial.i18n import gettext as _ |
|
51 | from mercurial.i18n import gettext as _ | |
53 | from mercurial.node import * |
|
52 | from mercurial.node import * | |
54 | demandload(globals(), 'mercurial:cmdutil,util os shutil tempfile') |
|
53 | from mercurial import cmdutil, util | |
|
54 | import os, shutil, tempfile | |||
55 |
|
55 | |||
56 | def dodiff(ui, repo, diffcmd, diffopts, pats, opts): |
|
56 | def dodiff(ui, repo, diffcmd, diffopts, pats, opts): | |
57 | def snapshot_node(files, node): |
|
57 | def snapshot_node(files, node): |
@@ -5,10 +5,9 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from mercurial.demandload import * |
|
|||
9 | from mercurial.i18n import gettext as _ |
|
8 | from mercurial.i18n import gettext as _ | |
10 | from mercurial.node import * |
|
9 | from mercurial.node import * | |
11 |
|
|
10 | from mercurial import commands, hg, node, util | |
12 |
|
11 | |||
13 | def fetch(ui, repo, source='default', **opts): |
|
12 | def fetch(ui, repo, source='default', **opts): | |
14 | '''Pull changes from a remote repository, merge new changes if needed. |
|
13 | '''Pull changes from a remote repository, merge new changes if needed. |
@@ -7,8 +7,8 b'' | |||||
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | from mercurial.i18n import gettext as _ |
|
9 | from mercurial.i18n import gettext as _ | |
10 | from mercurial.demandload import demandload |
|
10 | from mercurial import hg, util, commands, cmdutil | |
11 | demandload(globals(), "os sys sets mercurial:hg,util,commands,cmdutil") |
|
11 | import os, sys, sets | |
12 |
|
12 | |||
13 | versionstr = "0.0.3" |
|
13 | versionstr = "0.0.3" | |
14 |
|
14 |
@@ -5,9 +5,8 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from mercurial.demandload import * |
|
8 | import time, sys, signal, os | |
9 | demandload(globals(), 'time sys signal os') |
|
9 | from mercurial import hg, fancyopts, commands, ui, util, patch, revlog | |
10 | demandload(globals(), 'mercurial:hg,fancyopts,commands,ui,util,patch,revlog') |
|
|||
11 |
|
10 | |||
12 | def difftree(ui, repo, node1=None, node2=None, *files, **opts): |
|
11 | def difftree(ui, repo, node1=None, node2=None, *files, **opts): | |
13 | """diff trees from two commits""" |
|
12 | """diff trees from two commits""" |
@@ -29,11 +29,9 b' remove patch from applied stack ' | |||||
29 | refresh contents of top applied patch qrefresh |
|
29 | refresh contents of top applied patch qrefresh | |
30 | ''' |
|
30 | ''' | |
31 |
|
31 | |||
32 | from mercurial.demandload import * |
|
|||
33 | from mercurial.i18n import gettext as _ |
|
32 | from mercurial.i18n import gettext as _ | |
34 | from mercurial import commands |
|
33 | from mercurial import commands, cmdutil, hg, patch, revlog, util, changegroup | |
35 |
|
|
34 | import os, sys, re, struct, traceback, errno, bz2 | |
36 | demandload(globals(), "mercurial:cmdutil,hg,patch,revlog,util,changegroup") |
|
|||
37 |
|
35 | |||
38 | commands.norepo += " qclone qversion" |
|
36 | commands.norepo += " qclone qversion" | |
39 |
|
37 |
@@ -65,11 +65,10 b'' | |||||
65 | # if you like, you can put notify config file in repo that users can |
|
65 | # if you like, you can put notify config file in repo that users can | |
66 | # push changes to, they can manage their own subscriptions. |
|
66 | # push changes to, they can manage their own subscriptions. | |
67 |
|
67 | |||
68 | from mercurial.demandload import * |
|
|||
69 | from mercurial.i18n import gettext as _ |
|
68 | from mercurial.i18n import gettext as _ | |
70 | from mercurial.node import * |
|
69 | from mercurial.node import * | |
71 |
|
|
70 | from mercurial import patch, cmdutil, templater, util, mail | |
72 |
|
|
71 | import email.Parser, fnmatch, socket, time | |
73 |
|
72 | |||
74 | # template for single changeset can include email headers. |
|
73 | # template for single changeset can include email headers. | |
75 | single_template = ''' |
|
74 | single_template = ''' |
@@ -63,10 +63,9 b'' | |||||
63 | # |
|
63 | # | |
64 | # That should be all. Now your patchbomb is on its way out. |
|
64 | # That should be all. Now your patchbomb is on its way out. | |
65 |
|
65 | |||
66 | from mercurial.demandload import * |
|
66 | import os, errno, popen2, socket, sys, tempfile, time | |
67 |
|
|
67 | import email.MIMEMultipart, email.MIMEText, email.Utils | |
68 |
|
|
68 | from mercurial import cmdutil, commands, hg, mail, ui, patch | |
69 | os errno popen2 socket sys tempfile time''') |
|
|||
70 | from mercurial.i18n import gettext as _ |
|
69 | from mercurial.i18n import gettext as _ | |
71 | from mercurial.node import * |
|
70 | from mercurial.node import * | |
72 |
|
71 |
@@ -5,11 +5,10 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from mercurial.demandload import * |
|
|||
9 | from mercurial.i18n import gettext as _ |
|
8 | from mercurial.i18n import gettext as _ | |
10 | demandload(globals(), 'os tempfile') |
|
9 | import os, tempfile | |
11 |
|
|
10 | from mercurial import bundlerepo, cmdutil, commands, hg, merge, patch, revlog | |
12 | demandload(globals(), 'mercurial:revlog,util') |
|
11 | from mercurial import util | |
13 |
|
12 | |||
14 | '''patch transplanting tool |
|
13 | '''patch transplanting tool | |
15 |
|
14 |
@@ -5,8 +5,7 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from demandload import * |
|
8 | import cStringIO, changelog, errno, manifest, os, tempfile, util | |
9 | demandload(globals(), "cStringIO changelog errno manifest os tempfile util") |
|
|||
10 |
|
9 | |||
11 | # writes to metadata files are ordered. reads: changelog, manifest, |
|
10 | # writes to metadata files are ordered. reads: changelog, manifest, | |
12 | # normal files. writes: normal files, manifest, changelog. |
|
11 | # normal files. writes: normal files, manifest, changelog. |
@@ -5,10 +5,9 b'' | |||||
5 | # This software may be used and distributed according to the terms of |
|
5 | # This software may be used and distributed according to the terms of | |
6 | # the GNU General Public License, incorporated herein by reference. |
|
6 | # the GNU General Public License, incorporated herein by reference. | |
7 |
|
7 | |||
8 | from demandload import * |
|
|||
9 | from i18n import gettext as _ |
|
8 | from i18n import gettext as _ | |
10 | from node import * |
|
9 | from node import * | |
11 |
|
|
10 | import cStringIO, os, stat, tarfile, time, util, zipfile | |
12 |
|
11 | |||
13 | def tidyprefix(dest, prefix, suffixes): |
|
12 | def tidyprefix(dest, prefix, suffixes): | |
14 | '''choose prefix to use for names in archive. make sure prefix is |
|
13 | '''choose prefix to use for names in archive. make sure prefix is |
@@ -12,8 +12,7 b' of the GNU General Public License, incor' | |||||
12 |
|
12 | |||
13 | from node import * |
|
13 | from node import * | |
14 | from i18n import gettext as _ |
|
14 | from i18n import gettext as _ | |
15 | from demandload import demandload |
|
15 | import changegroup, util, os, struct, bz2, tempfile | |
16 | demandload(globals(), "changegroup util os struct bz2 tempfile") |
|
|||
17 |
|
16 | |||
18 | import localrepo, changelog, manifest, filelog, revlog |
|
17 | import localrepo, changelog, manifest, filelog, revlog | |
19 |
|
18 |
@@ -6,9 +6,9 b' changegroup.py - Mercurial changegroup m' | |||||
6 | This software may be used and distributed according to the terms |
|
6 | This software may be used and distributed according to the terms | |
7 | of the GNU General Public License, incorporated herein by reference. |
|
7 | of the GNU General Public License, incorporated herein by reference. | |
8 | """ |
|
8 | """ | |
|
9 | ||||
9 | from i18n import gettext as _ |
|
10 | from i18n import gettext as _ | |
10 | from demandload import * |
|
11 | import struct, os, bz2, zlib, util, tempfile | |
11 | demandload(globals(), "struct os bz2 zlib util tempfile") |
|
|||
12 |
|
12 | |||
13 | def getchunk(source): |
|
13 | def getchunk(source): | |
14 | """get a chunk from a changegroup""" |
|
14 | """get a chunk from a changegroup""" |
@@ -7,8 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from revlog import * |
|
8 | from revlog import * | |
9 | from i18n import gettext as _ |
|
9 | from i18n import gettext as _ | |
10 | from demandload import demandload |
|
10 | import os, time, util | |
11 | demandload(globals(), "os time util") |
|
|||
12 |
|
11 | |||
13 | def _string_escape(text): |
|
12 | def _string_escape(text): | |
14 | """ |
|
13 | """ |
@@ -5,11 +5,9 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from demandload import demandload |
|
|||
9 | from node import * |
|
8 | from node import * | |
10 | from i18n import gettext as _ |
|
9 | from i18n import gettext as _ | |
11 | demandload(globals(), 'os sys') |
|
10 | import os, sys, mdiff, util, templater, patch | |
12 | demandload(globals(), 'mdiff util templater patch') |
|
|||
13 |
|
11 | |||
14 | revrangesep = ':' |
|
12 | revrangesep = ':' | |
15 |
|
13 |
@@ -5,14 +5,14 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from demandload import demandload |
|
8 | import demandimport; demandimport.enable() | |
9 | from node import * |
|
9 | from node import * | |
10 | from i18n import gettext as _ |
|
10 | from i18n import gettext as _ | |
11 |
|
|
11 | import bisect, os, re, sys, signal, imp, urllib, pdb, shlex, stat | |
12 |
|
|
12 | import fancyopts, ui, hg, util, lock, revlog, bundlerepo | |
13 |
|
|
13 | import difflib, patch, time, help, mdiff, tempfile | |
14 |
|
|
14 | import traceback, errno, version, atexit | |
15 |
|
|
15 | import archival, changegroup, cmdutil, hgweb.server, sshserver | |
16 |
|
16 | |||
17 | class UnknownCommand(Exception): |
|
17 | class UnknownCommand(Exception): | |
18 | """Exception raised if command is not in the command table.""" |
|
18 | """Exception raised if command is not in the command table.""" |
@@ -7,8 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from node import * |
|
8 | from node import * | |
9 | from i18n import gettext as _ |
|
9 | from i18n import gettext as _ | |
10 | from demandload import demandload |
|
10 | import ancestor, bdiff, repo, revlog, util, os | |
11 | demandload(globals(), "ancestor bdiff repo revlog util os") |
|
|||
12 |
|
11 | |||
13 | class changectx(object): |
|
12 | class changectx(object): | |
14 | """A changecontext object makes access to data related to a particular |
|
13 | """A changecontext object makes access to data related to a particular |
@@ -9,8 +9,7 b' of the GNU General Public License, incor' | |||||
9 |
|
9 | |||
10 | from node import * |
|
10 | from node import * | |
11 | from i18n import gettext as _ |
|
11 | from i18n import gettext as _ | |
12 | from demandload import * |
|
12 | import struct, os, time, bisect, stat, strutil, util, re, errno | |
13 | demandload(globals(), "struct os time bisect stat strutil util re errno") |
|
|||
14 |
|
13 | |||
15 | class dirstate(object): |
|
14 | class dirstate(object): | |
16 | format = ">cllll" |
|
15 | format = ">cllll" |
@@ -6,8 +6,7 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 | from revlog import * |
|
8 | from revlog import * | |
9 | from demandload import * |
|
9 | import os | |
10 | demandload(globals(), "os") |
|
|||
11 |
|
10 | |||
12 | class filelog(revlog): |
|
11 | class filelog(revlog): | |
13 | def __init__(self, opener, path, defversion=REVLOG_DEFAULT_VERSION): |
|
12 | def __init__(self, opener, path, defversion=REVLOG_DEFAULT_VERSION): |
@@ -8,10 +8,11 b'' | |||||
8 |
|
8 | |||
9 | from node import * |
|
9 | from node import * | |
10 | from repo import * |
|
10 | from repo import * | |
11 | from demandload import * |
|
|||
12 | from i18n import gettext as _ |
|
11 | from i18n import gettext as _ | |
13 |
|
|
12 | import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo | |
14 | demandload(globals(), "errno lock os shutil util merge@_merge verify@_verify") |
|
13 | import errno, lock, os, shutil, util | |
|
14 | import merge as _merge | |||
|
15 | import verify as _verify | |||
15 |
|
16 | |||
16 | def _local(path): |
|
17 | def _local(path): | |
17 | return (os.path.isfile(util.drop_scheme('file', path)) and |
|
18 | return (os.path.isfile(util.drop_scheme('file', path)) and |
@@ -6,6 +6,11 b'' | |||||
6 | # This software may be used and distributed according to the terms |
|
6 | # This software may be used and distributed according to the terms | |
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | from mercurial.demandload import demandload |
|
9 | import hgweb_mod, hgwebdir_mod | |
10 | demandload(globals(), "mercurial.hgweb.hgweb_mod:hgweb") |
|
10 | ||
11 | demandload(globals(), "mercurial.hgweb.hgwebdir_mod:hgwebdir") |
|
11 | def hgweb(*args, **kwargs): | |
|
12 | return hgweb_mod.hgweb(*args, **kwargs) | |||
|
13 | ||||
|
14 | def hgwebdir(*args, **kwargs): | |||
|
15 | return hgwebdir_mod.hgwebdir(*args, **kwargs) | |||
|
16 |
@@ -7,7 +7,6 b'' | |||||
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | import os, mimetypes |
|
9 | import os, mimetypes | |
10 | import os.path |
|
|||
11 |
|
10 | |||
12 | def get_mtime(repo_path): |
|
11 | def get_mtime(repo_path): | |
13 | store_path = os.path.join(repo_path, ".hg") |
|
12 | store_path = os.path.join(repo_path, ".hg") |
@@ -6,17 +6,13 b'' | |||||
6 | # This software may be used and distributed according to the terms |
|
6 | # This software may be used and distributed according to the terms | |
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | import os |
|
9 | import os, mimetypes, re, zlib, ConfigParser, mimetools, cStringIO, sys | |
10 | import os.path |
|
10 | import tempfile, urllib, bz2 | |
11 | import mimetypes |
|
|||
12 | from mercurial.demandload import demandload |
|
|||
13 | demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile") |
|
|||
14 | demandload(globals(), 'urllib bz2') |
|
|||
15 | demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone,patch") |
|
|||
16 | demandload(globals(), "mercurial:revlog,templater") |
|
|||
17 | demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile,style_map") |
|
|||
18 | from mercurial.node import * |
|
11 | from mercurial.node import * | |
19 | from mercurial.i18n import gettext as _ |
|
12 | from mercurial.i18n import gettext as _ | |
|
13 | from mercurial import mdiff, ui, hg, util, archival, streamclone, patch | |||
|
14 | from mercurial import revlog, templater | |||
|
15 | from common import get_mtime, staticfile, style_map | |||
20 |
|
16 | |||
21 | def _up(p): |
|
17 | def _up(p): | |
22 | if p[0] != "/": |
|
18 | if p[0] != "/": |
@@ -6,13 +6,12 b'' | |||||
6 | # This software may be used and distributed according to the terms |
|
6 | # This software may be used and distributed according to the terms | |
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | import os |
|
9 | from mercurial import demandimport; demandimport.enable() | |
10 | from mercurial.demandload import demandload |
|
10 | import os, mimetools, cStringIO | |
11 | demandload(globals(), "mimetools cStringIO") |
|
|||
12 | demandload(globals(), "mercurial:ui,hg,util,templater") |
|
|||
13 | demandload(globals(), "mercurial.hgweb.hgweb_mod:hgweb") |
|
|||
14 | demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile,style_map") |
|
|||
15 | from mercurial.i18n import gettext as _ |
|
11 | from mercurial.i18n import gettext as _ | |
|
12 | from mercurial import ui, hg, util, templater | |||
|
13 | from common import get_mtime, staticfile, style_map | |||
|
14 | from hgweb_mod import hgweb | |||
16 |
|
15 | |||
17 | # This is a stopgap |
|
16 | # This is a stopgap | |
18 | class hgwebdir(object): |
|
17 | class hgwebdir(object): |
@@ -6,8 +6,7 b'' | |||||
6 | # This software may be used and distributed according to the terms |
|
6 | # This software may be used and distributed according to the terms | |
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | from mercurial.demandload import demandload |
|
9 | import socket, sys, cgi, os, errno | |
10 | demandload(globals(), "socket sys cgi os errno") |
|
|||
11 | from mercurial.i18n import gettext as _ |
|
10 | from mercurial.i18n import gettext as _ | |
12 |
|
11 | |||
13 | class wsgiapplication(object): |
|
12 | class wsgiapplication(object): |
@@ -6,11 +6,11 b'' | |||||
6 | # This software may be used and distributed according to the terms |
|
6 | # This software may be used and distributed according to the terms | |
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | from mercurial.demandload import demandload |
|
9 | import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer | |
10 | import os, sys, errno |
|
10 | from mercurial import ui, hg, util, templater | |
11 | demandload(globals(), "urllib BaseHTTPServer socket SocketServer") |
|
11 | from hgweb_mod import hgweb | |
12 | demandload(globals(), "mercurial:ui,hg,util,templater") |
|
12 | from hgwebdir_mod import hgwebdir | |
13 | demandload(globals(), "hgweb_mod:hgweb hgwebdir_mod:hgwebdir request:wsgiapplication") |
|
13 | from request import wsgiapplication | |
14 | from mercurial.i18n import gettext as _ |
|
14 | from mercurial.i18n import gettext as _ | |
15 |
|
15 | |||
16 | def _splitURI(uri): |
|
16 | def _splitURI(uri): |
@@ -9,9 +9,8 b'' | |||||
9 | from node import * |
|
9 | from node import * | |
10 | from remoterepo import * |
|
10 | from remoterepo import * | |
11 | from i18n import gettext as _ |
|
11 | from i18n import gettext as _ | |
12 | from demandload import * |
|
12 | import hg, os, urllib, urllib2, urlparse, zlib, util, httplib | |
13 | demandload(globals(), "hg os urllib urllib2 urlparse zlib util httplib") |
|
13 | import errno, keepalive, tempfile, socket, changegroup | |
14 | demandload(globals(), "errno keepalive tempfile socket changegroup") |
|
|||
15 |
|
14 | |||
16 | class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): |
|
15 | class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): | |
17 | def __init__(self, ui): |
|
16 | def __init__(self, ui): |
@@ -7,12 +7,10 b'' | |||||
7 |
|
7 | |||
8 | from node import * |
|
8 | from node import * | |
9 | from i18n import gettext as _ |
|
9 | from i18n import gettext as _ | |
10 | from demandload import * |
|
10 | import repo, appendfile, changegroup | |
11 | import repo |
|
11 | import changelog, dirstate, filelog, manifest, context | |
12 | demandload(globals(), "appendfile changegroup") |
|
12 | import re, lock, transaction, tempfile, stat, mdiff, errno, ui | |
13 | demandload(globals(), "changelog dirstate filelog manifest context") |
|
13 | import os, revlog, time, util | |
14 | demandload(globals(), "re lock transaction tempfile stat mdiff errno ui") |
|
|||
15 | demandload(globals(), "os revlog time util") |
|
|||
16 |
|
14 | |||
17 | class localrepository(repo.repository): |
|
15 | class localrepository(repo.repository): | |
18 | capabilities = ('lookup', 'changegroupsubset') |
|
16 | capabilities = ('lookup', 'changegroupsubset') |
@@ -5,8 +5,7 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from demandload import * |
|
8 | import errno, os, socket, time, util | |
9 | demandload(globals(), 'errno os socket time util') |
|
|||
10 |
|
9 | |||
11 | class LockException(IOError): |
|
10 | class LockException(IOError): | |
12 | def __init__(self, errno, strerror, filename, desc): |
|
11 | def __init__(self, errno, strerror, filename, desc): |
@@ -6,8 +6,7 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 | from i18n import gettext as _ |
|
8 | from i18n import gettext as _ | |
9 | from demandload import * |
|
9 | import os, re, smtplib, templater, util | |
10 | demandload(globals(), "os re smtplib templater util") |
|
|||
11 |
|
10 | |||
12 | def _smtp(ui): |
|
11 | def _smtp(ui): | |
13 | '''send mail using smtp.''' |
|
12 | '''send mail using smtp.''' |
@@ -7,9 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from revlog import * |
|
8 | from revlog import * | |
9 | from i18n import gettext as _ |
|
9 | from i18n import gettext as _ | |
10 | from demandload import * |
|
10 | import array, bisect, struct, mdiff | |
11 | demandload(globals(), "array bisect struct") |
|
|||
12 | demandload(globals(), "mdiff") |
|
|||
13 |
|
11 | |||
14 | class manifestdict(dict): |
|
12 | class manifestdict(dict): | |
15 | def __init__(self, mapping=None, flags=None): |
|
13 | def __init__(self, mapping=None, flags=None): |
@@ -5,9 +5,7 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from demandload import demandload |
|
8 | import bdiff, mpatch, re, struct, util | |
9 | import bdiff, mpatch |
|
|||
10 | demandload(globals(), "re struct util") |
|
|||
11 |
|
9 | |||
12 | def splitnewlines(text): |
|
10 | def splitnewlines(text): | |
13 | '''like str.splitlines, but only split on newlines.''' |
|
11 | '''like str.splitlines, but only split on newlines.''' |
@@ -7,8 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from node import * |
|
8 | from node import * | |
9 | from i18n import gettext as _ |
|
9 | from i18n import gettext as _ | |
10 | from demandload import * |
|
10 | import errno, util, os, tempfile | |
11 | demandload(globals(), "errno util os tempfile") |
|
|||
12 |
|
11 | |||
13 | def filemerge(repo, fw, fo, wctx, mctx): |
|
12 | def filemerge(repo, fw, fo, wctx, mctx): | |
14 | """perform a 3-way merge in the working directory |
|
13 | """perform a 3-way merge in the working directory |
@@ -7,8 +7,7 b' This software may be used and distribute' | |||||
7 | of the GNU General Public License, incorporated herein by reference. |
|
7 | of the GNU General Public License, incorporated herein by reference. | |
8 | """ |
|
8 | """ | |
9 |
|
9 | |||
10 | from demandload import demandload |
|
10 | import binascii | |
11 | demandload(globals(), "binascii") |
|
|||
12 |
|
11 | |||
13 | nullrev = -1 |
|
12 | nullrev = -1 | |
14 | nullid = "\0" * 20 |
|
13 | nullid = "\0" * 20 |
@@ -5,12 +5,11 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from demandload import demandload |
|
|||
9 | from i18n import gettext as _ |
|
8 | from i18n import gettext as _ | |
10 | from node import * |
|
9 | from node import * | |
11 |
|
|
10 | import base85, cmdutil, mdiff, util | |
12 |
|
|
11 | import cStringIO, email.Parser, errno, os, popen2, re, shutil, sha | |
13 | demandload(globals(), "sys tempfile zlib") |
|
12 | import sys, tempfile, zlib | |
14 |
|
13 | |||
15 | # helper functions |
|
14 | # helper functions | |
16 |
|
15 |
@@ -12,9 +12,8 b' of the GNU General Public License, incor' | |||||
12 |
|
12 | |||
13 | from node import * |
|
13 | from node import * | |
14 | from i18n import gettext as _ |
|
14 | from i18n import gettext as _ | |
15 | from demandload import demandload |
|
15 | import binascii, changegroup, errno, ancestor, mdiff, os | |
16 | demandload(globals(), "binascii changegroup errno ancestor mdiff os") |
|
16 | import sha, struct, util, zlib | |
17 | demandload(globals(), "sha struct util zlib") |
|
|||
18 |
|
17 | |||
19 | # revlog version strings |
|
18 | # revlog version strings | |
20 | REVLOGV0 = 0 |
|
19 | REVLOGV0 = 0 |
@@ -8,8 +8,7 b'' | |||||
8 | from node import * |
|
8 | from node import * | |
9 | from remoterepo import * |
|
9 | from remoterepo import * | |
10 | from i18n import gettext as _ |
|
10 | from i18n import gettext as _ | |
11 | from demandload import * |
|
11 | import hg, os, re, stat, util | |
12 | demandload(globals(), "hg os re stat util") |
|
|||
13 |
|
12 | |||
14 | class sshrepository(remoterepository): |
|
13 | class sshrepository(remoterepository): | |
15 | def __init__(self, ui, path, create=0): |
|
14 | def __init__(self, ui, path, create=0): |
@@ -6,10 +6,9 b'' | |||||
6 | # This software may be used and distributed according to the terms |
|
6 | # This software may be used and distributed according to the terms | |
7 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | # of the GNU General Public License, incorporated herein by reference. | |
8 |
|
8 | |||
9 | from demandload import demandload |
|
|||
10 | from i18n import gettext as _ |
|
9 | from i18n import gettext as _ | |
11 | from node import * |
|
10 | from node import * | |
12 |
|
|
11 | import os, streamclone, sys, tempfile, util | |
13 |
|
12 | |||
14 | class sshserver(object): |
|
13 | class sshserver(object): | |
15 | def __init__(self, ui, repo): |
|
14 | def __init__(self, ui, repo): |
@@ -7,10 +7,9 b'' | |||||
7 | # This software may be used and distributed according to the terms |
|
7 | # This software may be used and distributed according to the terms | |
8 | # of the GNU General Public License, incorporated herein by reference. |
|
8 | # of the GNU General Public License, incorporated herein by reference. | |
9 |
|
9 | |||
10 | from demandload import * |
|
|||
11 | from i18n import gettext as _ |
|
10 | from i18n import gettext as _ | |
12 |
|
|
11 | import changelog, filelog, httprangereader | |
13 |
|
|
12 | import repo, localrepo, manifest, os, urllib, urllib2, util | |
14 |
|
13 | |||
15 | class rangereader(httprangereader.httprangereader): |
|
14 | class rangereader(httprangereader.httprangereader): | |
16 | def read(self, size=None): |
|
15 | def read(self, size=None): |
@@ -5,9 +5,8 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from demandload import demandload |
|
|||
9 | from i18n import gettext as _ |
|
8 | from i18n import gettext as _ | |
10 | demandload(globals(), "os stat util lock") |
|
9 | import os, stat, util, lock | |
11 |
|
10 | |||
12 | # if server supports streaming clone, it advertises "stream" |
|
11 | # if server supports streaming clone, it advertises "stream" | |
13 | # capability with value that is version+flags of repo it is serving. |
|
12 | # capability with value that is version+flags of repo it is serving. |
@@ -5,10 +5,9 b'' | |||||
5 | # This software may be used and distributed according to the terms |
|
5 | # This software may be used and distributed according to the terms | |
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 | from demandload import demandload |
|
|||
9 | from i18n import gettext as _ |
|
8 | from i18n import gettext as _ | |
10 | from node import * |
|
9 | from node import * | |
11 |
|
|
10 | import cgi, re, sys, os, time, urllib, util, textwrap | |
12 |
|
11 | |||
13 | def parsestring(s, quoted=True): |
|
12 | def parsestring(s, quoted=True): | |
14 | '''parse a string using simple c-like syntax. |
|
13 | '''parse a string using simple c-like syntax. |
@@ -11,9 +11,8 b'' | |||||
11 | # This software may be used and distributed according to the terms |
|
11 | # This software may be used and distributed according to the terms | |
12 | # of the GNU General Public License, incorporated herein by reference. |
|
12 | # of the GNU General Public License, incorporated herein by reference. | |
13 |
|
13 | |||
14 | from demandload import demandload |
|
|||
15 | from i18n import gettext as _ |
|
14 | from i18n import gettext as _ | |
16 | demandload(globals(), 'os') |
|
15 | import os | |
17 |
|
16 | |||
18 | class transaction(object): |
|
17 | class transaction(object): | |
19 | def __init__(self, report, opener, journal, after=None): |
|
18 | def __init__(self, report, opener, journal, after=None): |
@@ -6,9 +6,8 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 | from i18n import gettext as _ |
|
8 | from i18n import gettext as _ | |
9 | from demandload import * |
|
9 | import errno, getpass, os, re, socket, sys, tempfile | |
10 | demandload(globals(), "errno getpass os re socket sys tempfile") |
|
10 | import ConfigParser, traceback, util | |
11 | demandload(globals(), "ConfigParser traceback util") |
|
|||
12 |
|
11 | |||
13 | def dupconfig(orig): |
|
12 | def dupconfig(orig): | |
14 | new = util.configparser(orig.defaults()) |
|
13 | new = util.configparser(orig.defaults()) |
@@ -13,9 +13,8 b' platform-specific details from the core.' | |||||
13 | """ |
|
13 | """ | |
14 |
|
14 | |||
15 | from i18n import gettext as _ |
|
15 | from i18n import gettext as _ | |
16 | from demandload import * |
|
16 | import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile | |
17 | demandload(globals(), "cStringIO errno getpass popen2 re shutil sys tempfile") |
|
17 | import os, threading, time, calendar, ConfigParser, locale | |
18 | demandload(globals(), "os threading time calendar ConfigParser locale") |
|
|||
19 |
|
18 | |||
20 | _encoding = os.environ.get("HGENCODING") or locale.getpreferredencoding() \ |
|
19 | _encoding = os.environ.get("HGENCODING") or locale.getpreferredencoding() \ | |
21 | or "ascii" |
|
20 | or "ascii" | |
@@ -693,7 +692,7 b' def checkfolding(path):' | |||||
693 |
|
692 | |||
694 | # Platform specific variants |
|
693 | # Platform specific variants | |
695 | if os.name == 'nt': |
|
694 | if os.name == 'nt': | |
696 | demandload(globals(), "msvcrt") |
|
695 | import msvcrt | |
697 | nulldev = 'NUL:' |
|
696 | nulldev = 'NUL:' | |
698 |
|
697 | |||
699 | class winstdout: |
|
698 | class winstdout: |
@@ -13,10 +13,10 b'' | |||||
13 |
|
13 | |||
14 | import win32api |
|
14 | import win32api | |
15 |
|
15 | |||
16 | from demandload import * |
|
|||
17 | from i18n import gettext as _ |
|
16 | from i18n import gettext as _ | |
18 |
|
|
17 | import errno, os, pywintypes, win32con, win32file, win32process | |
19 | demandload(globals(), 'cStringIO win32com.shell:shell,shellcon winerror') |
|
18 | import cStringIO, winerror | |
|
19 | from win32com.shell import shell,shellcon | |||
20 |
|
20 | |||
21 | class WinError: |
|
21 | class WinError: | |
22 | winerror_map = { |
|
22 | winerror_map = { |
@@ -13,8 +13,6 b' import os' | |||||
13 | from distutils.core import setup, Extension |
|
13 | from distutils.core import setup, Extension | |
14 | from distutils.command.install_data import install_data |
|
14 | from distutils.command.install_data import install_data | |
15 |
|
15 | |||
16 | # mercurial.packagescan must be the first mercurial module imported |
|
|||
17 | import mercurial.packagescan |
|
|||
18 | import mercurial.version |
|
16 | import mercurial.version | |
19 |
|
17 | |||
20 | # py2exe needs to be installed to work |
|
18 | # py2exe needs to be installed to work | |
@@ -35,31 +33,6 b' try:' | |||||
35 | except ImportError: |
|
33 | except ImportError: | |
36 | pass |
|
34 | pass | |
37 |
|
35 | |||
38 | # Due to the use of demandload py2exe is not finding the modules. |
|
|||
39 | # packagescan.getmodules creates a list of modules included in |
|
|||
40 | # the mercurial package plus depdent modules. |
|
|||
41 | from py2exe.build_exe import py2exe as build_exe |
|
|||
42 |
|
||||
43 | class py2exe_for_demandload(build_exe): |
|
|||
44 | """ overwrites the py2exe command class for getting the build |
|
|||
45 | directory and for setting the 'includes' option.""" |
|
|||
46 | def initialize_options(self): |
|
|||
47 | self.build_lib = None |
|
|||
48 | build_exe.initialize_options(self) |
|
|||
49 | def finalize_options(self): |
|
|||
50 | # Get the build directory, ie. where to search for modules. |
|
|||
51 | self.set_undefined_options('build', |
|
|||
52 | ('build_lib', 'build_lib')) |
|
|||
53 | # Sets the 'includes' option with the list of needed modules |
|
|||
54 | if not self.includes: |
|
|||
55 | self.includes = [] |
|
|||
56 | else: |
|
|||
57 | self.includes = self.includes.split(',') |
|
|||
58 | mercurial.packagescan.scan(self.build_lib, 'mercurial') |
|
|||
59 | mercurial.packagescan.scan(self.build_lib, 'mercurial.hgweb') |
|
|||
60 | mercurial.packagescan.scan(self.build_lib, 'hgext') |
|
|||
61 | self.includes += mercurial.packagescan.getmodules() |
|
|||
62 | build_exe.finalize_options(self) |
|
|||
63 | except ImportError: |
|
36 | except ImportError: | |
64 | py2exe_for_demandload = None |
|
37 | py2exe_for_demandload = None | |
65 |
|
38 |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now