[PATCH 2 of 8] convert: gnuarch use absolute_import

timeless timeless at mozdev.org
Wed Mar 2 10:51:52 EST 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1456909081 0
#      Wed Mar 02 08:58:01 2016 +0000
# Node ID d45ab933d87b4d9d221709f9d99c878944a3a57b
# Parent  e8877aee6ac2d40ce9e177c3436f7fe90e7fdb1a
convert: gnuarch use absolute_import

diff --git a/hgext/convert/gnuarch.py b/hgext/convert/gnuarch.py
--- a/hgext/convert/gnuarch.py
+++ b/hgext/convert/gnuarch.py
@@ -5,14 +5,22 @@
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
+from __future__ import absolute_import
 
-from common import NoRepo, commandline, commit, converter_source
+import email
+import os
+import shutil
+import stat
+import tempfile
+from mercurial import (
+    encoding,
+    error,
+    util,
+)
 from mercurial.i18n import _
-from mercurial import encoding, util, error
-import os, shutil, tempfile, stat
-from email.Parser import Parser
+from . import common
 
-class gnuarch_source(converter_source, commandline):
+class gnuarch_source(common.converter_source, common.commandline):
 
     class gnuarch_rev(object):
         def __init__(self, rev):
@@ -31,7 +39,7 @@
         super(gnuarch_source, self).__init__(ui, path, revs=revs)
 
         if not os.path.exists(os.path.join(path, '{arch}')):
-            raise NoRepo(_("%s does not look like a GNU Arch repository")
+            raise common.NoRepo(_("%s does not look like a GNU Arch repository")
                          % path)
 
         # Could use checktool, but we want to check for baz or tla.
@@ -44,7 +52,7 @@
             else:
                 raise error.Abort(_('cannot find a GNU Arch tool'))
 
-        commandline.__init__(self, ui, self.execmd)
+        common.commandline.__init__(self, ui, self.execmd)
 
         self.path = os.path.realpath(path)
         self.tmppath = None
@@ -54,7 +62,7 @@
         self.changes = {}
         self.parents = {}
         self.tags = {}
-        self.catlogparser = Parser()
+        self.catlogparser = email.Parser.Parser()
         self.encoding = encoding.encoding
         self.archives = []
 
@@ -175,8 +183,9 @@
 
     def getcommit(self, rev):
         changes = self.changes[rev]
-        return commit(author=changes.author, date=changes.date,
-                      desc=changes.summary, parents=self.parents[rev], rev=rev)
+        return common.commit(author=changes.author, date=changes.date,
+                             desc=changes.summary, parents=self.parents[rev],
+                             rev=rev)
 
     def gettags(self):
         return self.tags
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
@@ -41,7 +41,6 @@
   hgext/convert/cvsps.py not using absolute_import
   hgext/convert/darcs.py not using absolute_import
   hgext/convert/filemap.py not using absolute_import
-  hgext/convert/gnuarch.py not using absolute_import
   hgext/convert/hg.py not using absolute_import
   hgext/convert/monotone.py not using absolute_import
   hgext/convert/p4.py not using absolute_import


More information about the Mercurial-devel mailing list