Mercurial > hg
comparison mercurial/demandload.py @ 2956:6dddcba7596a
merge.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Fri, 18 Aug 2006 21:17:28 -0700 |
parents | a8a7ce1a01a5 |
children | 61afc32c1a49 |
comparison
equal
deleted
inserted
replaced
2955:9d1c3529ebbc | 2956:6dddcba7596a |
---|---|
94 modules is a string listing module names, separated by white | 94 modules is a string listing module names, separated by white |
95 space. names are handled like this: | 95 space. names are handled like this: |
96 | 96 |
97 foo import foo | 97 foo import foo |
98 foo bar import foo, bar | 98 foo bar import foo, bar |
99 foo@bar import foo as bar | |
99 foo.bar import foo.bar | 100 foo.bar import foo.bar |
100 foo:bar from foo import bar | 101 foo:bar from foo import bar |
101 foo:bar,quux from foo import bar, quux | 102 foo:bar,quux from foo import bar, quux |
102 foo.bar:quux from foo.bar import quux''' | 103 foo.bar:quux from foo.bar import quux''' |
103 | 104 |
106 if col >= 0: | 107 if col >= 0: |
107 fromlist = mod[col+1:].split(',') | 108 fromlist = mod[col+1:].split(',') |
108 mod = mod[:col] | 109 mod = mod[:col] |
109 else: | 110 else: |
110 fromlist = [] | 111 fromlist = [] |
112 as = None | |
113 if '@' in mod: | |
114 mod, as = mod.split("@") | |
111 importer = _importer(scope, mod, fromlist) | 115 importer = _importer(scope, mod, fromlist) |
112 if fromlist: | 116 if fromlist: |
113 for name in fromlist: | 117 for name in fromlist: |
114 scope[name] = _replacer_from(importer, name) | 118 scope[name] = _replacer_from(importer, name) |
115 else: | 119 else: |
124 later = object.__getattribute__(val, 'later') | 128 later = object.__getattribute__(val, 'later') |
125 later.append(mod[dot+1:]) | 129 later.append(mod[dot+1:]) |
126 continue | 130 continue |
127 else: | 131 else: |
128 basemod = mod | 132 basemod = mod |
129 scope[basemod] = _replacer(importer, basemod) | 133 if not as: |
134 as = basemod | |
135 scope[as] = _replacer(importer, as) |