changeset 40652:291080871f50

histedit: conditionalize the imports of 'fcntl' and 'termios' The recent import of chistedit in c36175456350 made Windows sad. I'm not sure if there's other stuff that needs to be done here (e.g. change the default interface), but this makes the tests run again. It would have been nicer if the error message indicated these modules were the problem, but instead it said "*** failed to import extension histedit: No module named histedit". I'm not sure if there's anything we can do about that.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 15 Nov 2018 17:36:15 -0500
parents 1243295fcc3a
children 6d0fdeda43f7
files hgext/histedit.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Fri Nov 16 14:21:47 2018 +0100
+++ b/hgext/histedit.py	Thu Nov 15 17:36:15 2018 -0500
@@ -183,11 +183,17 @@
 
 from __future__ import absolute_import
 
-import fcntl
+# chistedit dependencies that are not available everywhere
+try:
+    import fcntl
+    import termios
+except ImportError:
+    fcntl = None
+    termios = None
+
 import functools
 import os
 import struct
-import termios
 
 from mercurial.i18n import _
 from mercurial import (