equal
deleted
inserted
replaced
12 from mercurial.node import ( |
12 from mercurial.node import ( |
13 nullid, |
13 nullid, |
14 nullrev, |
14 nullrev, |
15 ) |
15 ) |
16 from mercurial import ( |
16 from mercurial import ( |
17 parsers, |
17 policy, |
18 ) |
18 ) |
|
19 |
|
20 parsers = policy.importmod(r'parsers') |
19 |
21 |
20 # original python implementation |
22 # original python implementation |
21 def gettype(q): |
23 def gettype(q): |
22 return int(q & 0xFFFF) |
24 return int(q & 0xFFFF) |
23 |
25 |
112 """Import mercurial.parsers with the given sys.hexversion.""" |
114 """Import mercurial.parsers with the given sys.hexversion.""" |
113 # The file parsers.c inspects sys.hexversion to determine the version |
115 # The file parsers.c inspects sys.hexversion to determine the version |
114 # of the currently-running Python interpreter, so we monkey-patch |
116 # of the currently-running Python interpreter, so we monkey-patch |
115 # sys.hexversion to simulate using different versions. |
117 # sys.hexversion to simulate using different versions. |
116 code = ("import sys; sys.hexversion=%s; " |
118 code = ("import sys; sys.hexversion=%s; " |
117 "import mercurial.parsers" % hexversion) |
119 "import mercurial.cext.parsers" % hexversion) |
118 cmd = "python -c \"%s\"" % code |
120 cmd = "python -c \"%s\"" % code |
119 # We need to do these tests inside a subprocess because parser.c's |
121 # We need to do these tests inside a subprocess because parser.c's |
120 # version-checking code happens inside the module init function, and |
122 # version-checking code happens inside the module init function, and |
121 # when using reload() to reimport an extension module, "The init function |
123 # when using reload() to reimport an extension module, "The init function |
122 # of extension modules is not called a second time" |
124 # of extension modules is not called a second time" |