##// END OF EJS Templates
parsers: fail fast if Python has wrong minor version (issue4110)...
parsers: fail fast if Python has wrong minor version (issue4110) This change causes an informative ImportError to be raised when importing the extension module parsers if the minor version of the currently-running Python interpreter doesn't match that of the Python that was used when compiling the extension module. Here is an example of what the new error looks like: Traceback (most recent call last): File "test.py", line 1, in <module> import mercurial.parsers ImportError: Python minor version mismatch: The Mercurial extension modules were compiled with Python 2.7.6, but Mercurial is currently using Python with sys.hexversion=33883888: Python 2.5.6 (r256:88840, Nov 18 2012, 05:37:10) [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] at: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/Resources/ Python.app/Contents/MacOS/Python The reason for raising an error in this scenario is that Python's C API is known not to be compatible from minor version to minor version, even if sys.api_version is the same. See for example this Python bug report about incompatibilities between 2.5 and 2.6+: http://bugs.python.org/issue8118 These incompatibilities can cause Mercurial to break in mysterious, unforeseen ways. For example, when Mercurial compiled with Python 2.7 was run with 2.5, the following crash occurred when running "hg status": http://bz.selenic.com/show_bug.cgi?id=4110 After this crash was fixed, running with Python 2.5 no longer crashes, but the following puzzling behavior still occurs: $ hg status ... File ".../mercurial/changelog.py", line 123, in __init__ revlog.revlog.__init__(self, opener, "00changelog.i") File ".../mercurial/revlog.py", line 251, in __init__ d = self._io.parseindex(i, self._inline) File ".../mercurial/revlog.py", line 158, in parseindex index, cache = parsers.parse_index2(data, inline) TypeError: data is not a string which can be reproduced more simply with: import mercurial.parsers as parsers parsers.parse_index2("", True) Both the crash and the TypeError occurred because the Python C API's PyString_Check returns the wrong value when the C header files from Python 2.7 are run with Python 2.5. This is an example of an incompatibility of the sort mentioned in the Python bug report above. Failing fast with an informative error message will result in a better user experience in cases like the above. The information in the ImportError will also simplify troubleshooting for those on Mercurial mailing lists, the bug tracker, etc. This patch only adds the version check to parsers.c, which is sufficient to affect command-line commands like "hg status" and "hg summary". An idea for a future improvement is to move the version-checking C code to a more central location, and have it run when importing all Mercurial extension modules and not just parsers.c.
Chris Jerdonek -
r20155:21dafd85 default
Show More
Name Size Modified Last Commit Author
/ contrib / win32
ReadMe.html Loading ...
buildlocal.bat Loading ...
hg.bat Loading ...
hgwebdir_wsgi.py Loading ...
mercurial.ico Loading ...
mercurial.ini Loading ...
mercurial.iss Loading ...
postinstall.txt Loading ...
win32-build.txt Loading ...


<html>
<head>
<title>Mercurial for Windows</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<style type="text/css">

</style>
</head>

<body>

Mercurial for Windows



Welcome to Mercurial for Windows!




Mercurial is a command-line application. You must run it from
the Windows command prompt (or if you're hard core, a <a<br /> href="http://www.mingw.org/">MinGW shell).




Note: the standard http://www.mingw.org/">MinGW
msys startup script uses rxvt which has problems setting up
standard input and output. Running bash directly works
correctly.




For documentation, please visit the <a<br /> href="http://mercurial.selenic.com/">Mercurial web site.
You can also download a free book, <a<br /> href="http://hgbook.red-bean.com/">Mercurial: The Definitive
Guide.




By default, Mercurial installs to C:\Program
Files\Mercurial
. The Mercurial command is called
hg.exe.



Testing Mercurial after you've installed it




The easiest way to check that Mercurial is installed properly is
to just type the following at the command prompt:




hg



This command should print a useful help message. If it does,
other Mercurial commands should work fine for you.



Configuration notes


Default editor



The default editor for commit messages is 'notepad'. You can set
the EDITOR (or HGEDITOR) environment variable
to specify your preference or set it in mercurial.ini:



[ui]
editor = whatever


Configuring a Merge program



It should be emphasized that Mercurial by itself doesn't attempt
to do a Merge at the file level, neither does it make any
attempt to Resolve the conflicts.




By default, Mercurial will use the merge program defined by the
HGMERGE environment variable, or uses the one defined
in the mercurial.ini file. (see <a<br /> href="http://mercurial.selenic.com/wiki/MergeProgram">MergeProgram
on the Mercurial Wiki for more information)



Reporting problems




Before you report any problems, please consult the <a<br /> href="http://mercurial.selenic.com/">Mercurial web site
and see if your question is already in our list of <a<br /> href="http://mercurial.selenic.com/wiki/FAQ">Frequently
Answered Questions (the "FAQ").




If you cannot find an answer to your question, please feel free
to send mail to the Mercurial mailing list, at <a<br /> href="mailto:mercurial@selenic.com">mercurial@selenic.com.
Remember, the more useful information you include in your
report, the easier it will be for us to help you!




If you are IRC-savvy, that's usually the fastest way to get
help. Go to #mercurial on irc.freenode.net.



Author and copyright information




Mercurial was written by http://www.selenic.com">Matt
Mackall, and is maintained by Matt and a team of volunteers.




The Windows installer was written by <a<br /> href="http://www.serpentine.com/blog">Bryan O'Sullivan.




Mercurial is Copyright 2005-2013 Matt Mackall and others. See
the Contributors.txt file for a list of contributors.




Mercurial is free software; you can redistribute it and/or
modify it under the terms of the <a<br /> href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt">GNU
General Public License version 2 or any later version.




Mercurial is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty
of merchantability or fitness for a particular
purpose
. See the GNU General Public License for more
details.


</body>
</html>