Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
mercurial-devel
Commits
252d2260c74e
Commit
252d2260c74e
authored
7 years ago
by
Yuya Nishihara
Browse files
Options
Downloads
Patches
Plain Diff
demandimport: look for 'mod' suffix as alternative name for module reference
It's widely used in our codebase.
parent
63365e9621d6
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hgdemandimport/demandimportpy2.py
+5
-2
5 additions, 2 deletions
hgdemandimport/demandimportpy2.py
tests/test-demandimport.py
+6
-0
6 additions, 0 deletions
tests/test-demandimport.py
tests/test-demandimport.py.out
+2
-0
2 additions, 0 deletions
tests/test-demandimport.py.out
with
13 additions
and
2 deletions
hgdemandimport/demandimportpy2.py
+
5
−
2
View file @
252d2260
...
...
@@ -132,8 +132,11 @@
subload
(
mod
,
x
)
# Replace references to this proxy instance with the actual module.
if
locals
and
locals
.
get
(
head
)
is
self
:
locals
[
head
]
=
mod
if
locals
:
if
locals
.
get
(
head
)
is
self
:
locals
[
head
]
=
mod
elif
locals
.
get
(
head
+
r
'
mod
'
)
is
self
:
locals
[
head
+
r
'
mod
'
]
=
mod
for
modname
in
modrefs
:
modref
=
sys
.
modules
.
get
(
modname
,
None
)
...
...
This diff is collapsed.
Click to expand it.
tests/test-demandimport.py
+
6
−
0
View file @
252d2260
...
...
@@ -52,6 +52,9 @@
import
re
as
fred
print
(
"
fred =
"
,
f
(
fred
))
import
re
as
remod
print
(
"
remod =
"
,
f
(
remod
))
import
sys
as
re
print
(
"
re =
"
,
f
(
re
))
...
...
@@ -59,6 +62,9 @@
print
(
"
fred.sub =
"
,
f
(
fred
.
sub
))
print
(
"
fred =
"
,
f
(
fred
))
remod
.
escape
# use remod
print
(
"
remod =
"
,
f
(
remod
))
print
(
"
re =
"
,
f
(
re
))
print
(
"
re.stderr =
"
,
f
(
re
.
stderr
))
print
(
"
re =
"
,
f
(
re
))
...
...
This diff is collapsed.
Click to expand it.
tests/test-demandimport.py.out
+
2
−
0
View file @
252d2260
...
...
@@ -9,7 +9,8 @@
hgweb_mod = <unloaded module 'hgweb_mod'>
hgweb = <module 'mercurial.hgweb' from '?'>
fred = <unloaded module 're'>
remod = <unloaded module 're'>
re = <unloaded module 'sys'>
fred = <unloaded module 're'>
fred.sub = <function sub at 0x?>
fred = <proxied module 're'>
...
...
@@ -12,7 +13,8 @@
re = <unloaded module 'sys'>
fred = <unloaded module 're'>
fred.sub = <function sub at 0x?>
fred = <proxied module 're'>
remod = <module 're' from '?'>
re = <unloaded module 'sys'>
re.stderr = <open file '<whatever>', mode 'w' at 0x?>
re = <proxied module 'sys'>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment