# HG changeset patch
# User Mateusz Kwapich <mitran...@fb.com>
# Date 1476020560 25200
#      Sun Oct 09 06:42:40 2016 -0700
# Node ID e998d6ca8cc7d27a4dd84e92d2bc0683a96c4d93
# Parent  da08f4707282747cef3619341e07bd492470f41e
py3: migrate pywatchman to absolute_import

diff --git a/hgext/fsmonitor/pywatchman/__init__.py 
b/hgext/fsmonitor/pywatchman/__init__.py
--- a/hgext/fsmonitor/pywatchman/__init__.py
+++ b/hgext/fsmonitor/pywatchman/__init__.py
@@ -26,6 +26,8 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from __future__ import absolute_import
+
 import os
 import errno
 import math
@@ -36,11 +38,11 @@ import time
 # Sometimes it's really hard to get Python extensions to compile,
 # so fall back to a pure Python implementation.
 try:
-    import bser
+    from . import bser
 except ImportError:
-    import pybser as bser
+    from . import pybser as bser
 
-import capabilities
+from . import capabilities
 
 if os.name == 'nt':
     import ctypes
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -4,7 +4,6 @@
   $ cd "$TESTDIR"/..
 
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python 
contrib/check-py3-compat.py
-  hgext/fsmonitor/pywatchman/__init__.py not using absolute_import
   hgext/fsmonitor/pywatchman/__init__.py requires print_function
   hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import
   hgext/fsmonitor/pywatchman/pybser.py not using absolute_import
@@ -20,9 +19,9 @@
   hgext/convert/convcmd.py: error importing: <SyntaxError> cannot mix bytes 
and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
   hgext/convert/subversion.py: error importing: <SyntaxError> cannot mix bytes 
and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
   hgext/convert/transport.py: error importing: <SyntaxError> cannot mix bytes 
and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
-  hgext/fsmonitor/pywatchman/capabilities.py: error importing: <ImportError> 
No module named 'pybser' (error at __init__.py:*)
-  hgext/fsmonitor/pywatchman/pybser.py: error importing: <ImportError> No 
module named 'pybser' (error at __init__.py:*)
-  hgext/fsmonitor/watchmanclient.py: error importing: <ImportError> No module 
named 'pybser' (error at __init__.py:*)
+  hgext/fsmonitor/pywatchman/capabilities.py: error importing: <SyntaxError> 
invalid or missing encoding declaration (error at __init__.py:*)
+  hgext/fsmonitor/pywatchman/pybser.py: error importing: <SyntaxError> invalid 
or missing encoding declaration (error at __init__.py:*)
+  hgext/fsmonitor/watchmanclient.py: error importing: <SyntaxError> invalid or 
missing encoding declaration (error at __init__.py:*)
   hgext/journal.py: error importing: <ValueError> Type names and field names 
must be valid identifiers: "b'journalentry'" (error at journal.py:*)
   hgext/largefiles/basestore.py: error importing: <SyntaxError> cannot mix 
bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
   hgext/largefiles/lfcommands.py: error importing: <SyntaxError> cannot mix 
bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to