For binary installs, the 'name' argument would be reused as a local variable,
destroying its original value. The patch fixes that, and also avoids copying
sys.path when it's not necessary.
Prior to this change, if a Python hook module failed to load (e.g. due
to an import error or path problem), it was impossible to figure out
why the error occurred, because the ImportErrors that got raised were
caught but never displayed.
If run with --traceback or ui.traceback=True, hg now prints tracebacks
of both of the ImportError instances that get raised before it bails.
When using hgwebdir with WSGI via the IIS ISAPI-WSGI extension, both
stdout and stderr filenos are set to -2, which makes the os.dup call
in hook.py fail.
Bottom portion fixes full path imports on source installs on Windows.
The top portion further fixes full path imports on binary installs.
Initial patch by Roman V. Kiseliov
- add writepending to flush delayed writes to separate file
- add support in hooks for lazy evaluation of callable parameters
- add HG_PENDING to pretxn hooks
- call writepending if hook is used
- pass repo root to hook environment
- if HG_PENDING = repo root, we're in pretxn hook
- read pending data to make pending changesets visible
- filter HG_PENDING in tests/printenv.py
The only non-obvious part is the use of sys.{__stderr__,__stdout__},
which is needed because sshserver overrides sys.stdout.
This makes a test that I added back in revision d71c96fd819f ineffective.