[PATCH 1 of 4] revlog: use absolute_import

Matt Mackall mpm at selenic.com
Thu Jul 16 12:28:10 CDT 2015


On Tue, 2015-07-14 at 13:51 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1436894831 25200
> #      Tue Jul 14 10:27:11 2015 -0700
> # Node ID 5154b8421ebd670d6155659c5811f193f5fe1555
> # Parent  35fa7c77c754aa4d156c42abfdb61ca178468872
> revlog: use absolute_import
> 
> This is needed for Python 3 compatibility. We have static analysis
> checks in place to ensure files using absolute_import conform to the
> style adopted by this patch.

More weird test failures on 2.6:

........
--- /home/mpm/hg-test-/tests/test-help.t
+++ /home/mpm/hg-test-/tests/test-help.t.err
@@ -1244,6 +1244,15 @@
 
   $ cd "$TESTDIR"/../doc
   $ python check-seclevel.py
+  Traceback (most recent call last):
+    File "check-seclevel.py", line 168, in <module>
+      if checkhghelps():
+    File "check-seclevel.py", line 99, in checkhghelps
+      mod = extensions.load(None, name, None)
+    File "../mercurial/extensions.py", line 86, in load
+      ui.debug('could not import hgext.%s (%s): trying %s\n'
+  AttributeError: 'NoneType' object has no attribute 'debug'
+  [1]
   $ cd $TESTTMP
 
 #if serve

ERROR: test-help.t output changed
!......
--- /home/mpm/hg-test-/tests/test-extension.t
+++ /home/mpm/hg-test-/tests/test-extension.t.err
@@ -949,12 +949,15 @@
   $ if [ -z "$hgver" ]; then
   >   echo "unable to fetch a mercurial version. Make sure __version__
is correct";
   > fi
+  unable to fetch a mercurial version. Make sure __version__ is correct
   $ rm -f throw.pyc throw.pyo
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** unknown exception encountered, please report by visiting
-  ** http://mercurial.selenic.com/wiki/BugTracker
-  ** Python * (glob)
-  ** Mercurial Distributed SCM (*) (glob)
+  ** Unknown exception encountered with possibly-broken third-party
extension throw
+  ** which supports versions unknown of Mercurial.
+  ** Please disable throw and try your action again.
+  ** If that fixes the bug please report it to http://example.com/bts
+  ** Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36) [GCC 4.4.7
20120313 (Red Hat 4.4.7-4)]
+  ** Mercurial Distributed SCM (version +0-)
   ** Extensions loaded: throw
 
 Patch version is ignored during compatibility check



> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -10,14 +10,31 @@
>  This provides efficient delta storage with O(1) retrieve and append
>  and O(changes) merge between branches.
>  """
>  
> -# import stuff from node for others to import from revlog
> +from __future__ import absolute_import
> +
>  import collections
> -from node import bin, hex, nullid, nullrev
> -from i18n import _
> -import ancestor, mdiff, parsers, error, util, templatefilters
> -import struct, zlib, errno
> +import errno
> +import struct
> +import zlib
> +
> +from .i18n import _
> +from .node import (
> +    bin,
> +    hex,
> +    nullid,
> +    nullrev,
> +)
> +
> +from . import (
> +    ancestor,
> +    error,
> +    mdiff,
> +    parsers,
> +    templatefilters,
> +    util,
> +)
>  
>  _pack = struct.pack
>  _unpack = struct.unpack
>  _compress = zlib.compress
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list