Patchwork [8,of,8,v3] convert: monotone use absolute_import

login
register
mail settings
Submitter timeless@mozdev.org
Date March 2, 2016, 8:55 p.m.
Message ID <83368be25d8aae449d52.1456952157@waste.org>
Download mbox | patch
Permalink /patch/13562/
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 1456933834 0
#      Wed Mar 02 15:50:34 2016 +0000
# Node ID 83368be25d8aae449d5252e0a95496b884dfa5b7
# Parent  89ec8bdfa9f21e14005b92f8b1ff98b8d103a663
convert: monotone use absolute_import
Augie Fackler - March 8, 2016, 3:17 a.m.
On Wed, Mar 02, 2016 at 02:55:57PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1456933834 0
> #      Wed Mar 02 15:50:34 2016 +0000
> # Node ID 83368be25d8aae449d5252e0a95496b884dfa5b7
> # Parent  89ec8bdfa9f21e14005b92f8b1ff98b8d103a663
> convert: monotone use absolute_import

these are queued, thanks

>
> diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py
> --- a/hgext/convert/monotone.py
> +++ b/hgext/convert/monotone.py
> @@ -5,28 +5,34 @@
>  #
>  # 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
>
> -import os, re
> -from mercurial import util, error
> -from common import NoRepo, commit, converter_source, checktool
> -from common import commandline
> +import os
> +import re
> +
> +from mercurial import (
> +    error,
> +    util,
> +)
>  from mercurial.i18n import _
>
> -class monotone_source(converter_source, commandline):
> +from . import common
> +
> +class monotone_source(common.converter_source, common.commandline):
>      def __init__(self, ui, path=None, revs=None):
> -        converter_source.__init__(self, ui, path, revs)
> +        common.converter_source.__init__(self, ui, path, revs)
>          if revs and len(revs) > 1:
>              raise error.Abort(_('monotone source does not support specifying '
>                                 'multiple revs'))
> -        commandline.__init__(self, ui, 'mtn')
> +        common.commandline.__init__(self, ui, 'mtn')
>
>          self.ui = ui
>          self.path = path
>          self.automatestdio = False
>          self.revs = revs
>
> -        norepo = NoRepo(_("%s does not look like a monotone repository")
> -                        % path)
> +        norepo = common.NoRepo(_("%s does not look like a monotone repository")
> +                             % path)
>          if not os.path.exists(os.path.join(path, '_MTN')):
>              # Could be a monotone repository (SQLite db file)
>              try:
> @@ -69,7 +75,7 @@
>          self.files = None
>          self.dirs  = None
>
> -        checktool('mtn', abort=False)
> +        common.checktool('mtn', abort=False)
>
>      def mtnrun(self, *args, **kwargs):
>          if self.automatestdio:
> @@ -302,7 +308,7 @@
>          certs = self.mtngetcerts(rev)
>          if certs.get('suspend') == certs["branch"]:
>              extra['close'] = 1
> -        return commit(
> +        return common.commit(
>              author=certs["author"],
>              date=util.datestr(util.strdate(certs["date"], "%Y-%m-%dT%H:%M:%S")),
>              desc=certs["changelog"],
> 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
> @@ -38,7 +38,6 @@
>    hgext/convert/common.py not using absolute_import
>    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/subversion.py not using absolute_import
>    hgext/convert/transport.py not using absolute_import
>    hgext/eol.py not using absolute_import
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py
--- a/hgext/convert/monotone.py
+++ b/hgext/convert/monotone.py
@@ -5,28 +5,34 @@ 
 #
 # 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
 
-import os, re
-from mercurial import util, error
-from common import NoRepo, commit, converter_source, checktool
-from common import commandline
+import os
+import re
+
+from mercurial import (
+    error,
+    util,
+)
 from mercurial.i18n import _
 
-class monotone_source(converter_source, commandline):
+from . import common
+
+class monotone_source(common.converter_source, common.commandline):
     def __init__(self, ui, path=None, revs=None):
-        converter_source.__init__(self, ui, path, revs)
+        common.converter_source.__init__(self, ui, path, revs)
         if revs and len(revs) > 1:
             raise error.Abort(_('monotone source does not support specifying '
                                'multiple revs'))
-        commandline.__init__(self, ui, 'mtn')
+        common.commandline.__init__(self, ui, 'mtn')
 
         self.ui = ui
         self.path = path
         self.automatestdio = False
         self.revs = revs
 
-        norepo = NoRepo(_("%s does not look like a monotone repository")
-                        % path)
+        norepo = common.NoRepo(_("%s does not look like a monotone repository")
+                             % path)
         if not os.path.exists(os.path.join(path, '_MTN')):
             # Could be a monotone repository (SQLite db file)
             try:
@@ -69,7 +75,7 @@ 
         self.files = None
         self.dirs  = None
 
-        checktool('mtn', abort=False)
+        common.checktool('mtn', abort=False)
 
     def mtnrun(self, *args, **kwargs):
         if self.automatestdio:
@@ -302,7 +308,7 @@ 
         certs = self.mtngetcerts(rev)
         if certs.get('suspend') == certs["branch"]:
             extra['close'] = 1
-        return commit(
+        return common.commit(
             author=certs["author"],
             date=util.datestr(util.strdate(certs["date"], "%Y-%m-%dT%H:%M:%S")),
             desc=certs["changelog"],
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
@@ -38,7 +38,6 @@ 
   hgext/convert/common.py not using absolute_import
   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/subversion.py not using absolute_import
   hgext/convert/transport.py not using absolute_import
   hgext/eol.py not using absolute_import