Patchwork [7,of,8,v3] convert: p4 use absolute_import

login
register
mail settings
Submitter timeless@mozdev.org
Date March 2, 2016, 8:55 p.m.
Message ID <89ec8bdfa9f21e14005b.1456952156@waste.org>
Download mbox | patch
Permalink /patch/13561/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

timeless@mozdev.org - March 2, 2016, 8:55 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1456932675 0
#      Wed Mar 02 15:31:15 2016 +0000
# Node ID 89ec8bdfa9f21e14005b92f8b1ff98b8d103a663
# Parent  374b3f8c859a4b14b7899255360ef1bc44af1205
convert: p4 use absolute_import

Patch

diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py
--- a/hgext/convert/p4.py
+++ b/hgext/convert/p4.py
@@ -4,13 +4,18 @@ 
 #
 # 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 mercurial import util, error
+import marshal
+import re
+
+from mercurial import (
+    error,
+    util,
+)
 from mercurial.i18n import _
 
-from common import commit, converter_source, checktool, NoRepo
-import marshal
-import re
+from . import common
 
 def loaditer(f):
     "Yield the dictionary objects generated by p4"
@@ -37,17 +42,18 @@ 
         filename = filename.replace(k, v)
     return filename
 
-class p4_source(converter_source):
+class p4_source(common.converter_source):
     def __init__(self, ui, path, revs=None):
         # avoid import cycle
-        import convcmd
+        from . import convcmd
 
         super(p4_source, self).__init__(ui, path, revs=revs)
 
         if "/" in path and not path.startswith('//'):
-            raise NoRepo(_('%s does not look like a P4 repository') % path)
+            raise common.NoRepo(_('%s does not look like a P4 repository') %
+                                path)
 
-        checktool('p4', abort=False)
+        common.checktool('p4', abort=False)
 
         self.p4changes = {}
         self.heads = {}
@@ -142,10 +148,10 @@ 
                 parents = []
 
             date = (int(d["time"]), 0)     # timezone not set
-            c = commit(author=self.recode(d["user"]),
-                       date=util.datestr(date, '%Y-%m-%d %H:%M:%S %1%2'),
-                       parents=parents, desc=desc, branch=None,
-                       extra={"p4": change})
+            c = common.commit(author=self.recode(d["user"]),
+                              date=util.datestr(date, '%Y-%m-%d %H:%M:%S %1%2'),
+                              parents=parents, desc=desc, branch=None,
+                              extra={"p4": change})
 
             files = []
             copies = {}
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
@@ -39,7 +39,6 @@ 
   hgext/convert/convcmd.py not using absolute_import
   hgext/convert/cvs.py not using absolute_import
   hgext/convert/monotone.py not using absolute_import
-  hgext/convert/p4.py not using absolute_import
   hgext/convert/subversion.py not using absolute_import
   hgext/convert/transport.py not using absolute_import
   hgext/eol.py not using absolute_import