hgsubversion: move to absolute import

Summary:
Let's move hgsubversion to absolute_import, just to be consistent with the rest
of Mercurial codebase.

Reviewed By: markbt

Differential Revision: D15392154

fbshipit-source-id: e4c32939aff0616790828da508f3feea158669e1
This commit is contained in:
Kostia Balytskyi 2019-05-21 09:06:46 -07:00 committed by Facebook Github Bot
parent 14bf3a15b0
commit fb54cc5694
68 changed files with 181 additions and 64 deletions

View File

@ -17,17 +17,11 @@ details.
For more information and instructions, see :hg:`help subversion`.
"""
testedwith = "3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4"
from __future__ import absolute_import
import os
import zlib
import compathacks
import svncommands
import svnexternals
import svnrepo
import util
import wrappers
from edenscm.mercurial import (
commands,
demandimport,
@ -42,6 +36,11 @@ from edenscm.mercurial import (
util as hgutil,
)
from . import compathacks, svncommands, svnexternals, svnrepo, util, wrappers
testedwith = "3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4"
try:
from edenscm.mercurial import exchange

View File

@ -2,6 +2,8 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import errno
import sys

View File

@ -1,16 +1,16 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import errno
import os
import shutil
import sys
import tempfile
import svnexternals
import svnwrap
import util
from edenscm.mercurial import match as matchmod, node, revlog, util as hgutil
from . import svnexternals, svnwrap, util
from ..extlib import cstore

View File

@ -7,6 +7,8 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import edenscm.hgext.hgsubversion
import edenscm.hgext.hgsubversion.svncommands
import edenscm.hgext.hgsubversion.util

View File

@ -8,12 +8,12 @@ other path translation necessary.
NB: this has a long way to go before it does everything it claims to
"""
from __future__ import absolute_import
import custom
import single
import standard
from edenscm.mercurial import util as hgutil
from . import custom, single, standard
__all__ = ["layout_from_name"]

View File

@ -6,6 +6,7 @@ This module should not contain any implementation, just a definition
of the API concrete layouts are expected to implement.
"""
from __future__ import absolute_import
class BaseLayout(object):

View File

@ -8,9 +8,12 @@ want a couple of branches.
"""
import base
from __future__ import absolute_import
from edenscm.mercurial import util as hgutil
from . import base
class CustomLayout(base.BaseLayout):
def __init__(self, meta):

View File

@ -1,4 +1,6 @@
import base
from __future__ import absolute_import
from . import base
class SingleLayout(base.BaseLayout):

View File

@ -1,6 +1,8 @@
# no-check-code -- see T24862348
import base
from __future__ import absolute_import
from . import base
class StandardLayout(base.BaseLayout):

View File

@ -2,6 +2,8 @@
""" Module for self-contained maps. """
from __future__ import absolute_import
import collections
import contextlib
import errno
@ -11,10 +13,11 @@ import sqlite3
import subprocess
import sys
import util
from edenscm.mercurial import error, util as hgutil
from edenscm.mercurial.node import bin, hex, nullid
from . import util
class BaseMap(dict):
"""A base class for the different type of mappings: author, branch, and

View File

@ -1,12 +1,13 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import re as remod
import svnexternals
import svnwrap
import util
from edenscm.mercurial import util as hgutil
from . import svnexternals, svnwrap, util
class NoFilesException(Exception):
"""Exception raised when you try and commit without files.

View File

@ -1,11 +1,12 @@
from __future__ import absolute_import
import errno
import traceback
import compathacks
import svnexternals
import util
from edenscm.mercurial import context, node, revlog, util as hgutil
from . import compathacks, svnexternals, util
class MissingPlainTextError(Exception):
"""Exception raised when the repo lacks a source file required for replaying

View File

@ -4,12 +4,10 @@ import cStringIO
import errno
import re
import compathacks
import svnexternals
import svnwrap
import util
from edenscm.mercurial import context, node, patch, revlog, util as hgutil
from . import compathacks, svnexternals, svnwrap, util
# Here is a diff mixing content and property changes in svn >= 1.7
#

View File

@ -1,18 +1,16 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import errno
import os
import sys
import traceback
import svnexternals
import svnmeta
import svnrepo
import svnwrap
import util
import verify
from edenscm.mercurial import commands, error, hg, node, progress, util as hgutil
from . import svnexternals, svnmeta, svnrepo, svnwrap, util, verify
def updatemeta(ui, repo, args, **opts):
"""Do a partial rebuild of the subversion metadata.

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import cStringIO
import os
import re
@ -7,10 +9,11 @@ import shutil
import stat
import subprocess
import util
from edenscm.mercurial import util as hgutil
from edenscm.mercurial.i18n import _
from . import util
try:
from edenscm.mercurial import scmutil

View File

@ -1,16 +1,14 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import posixpath
import compathacks
import editor
import layouts
import maps
import svnwrap
import util
from edenscm.mercurial import context, node, revlog, util as hgutil
from . import compathacks, editor, layouts, maps, svnwrap, util
class SVNMeta(object):
def __init__(self, repo, uuid=None, subdir=None, skiperrorcheck=False):

View File

@ -16,15 +16,15 @@ subclass: pull() is called on the instance pull *to*, but not the one pulled
are used to distinguish and filter these operations from others.
"""
from __future__ import absolute_import
import errno
import svnmeta
import svnwrap
import util
import wrappers
from edenscm.mercurial import error, httppeer, localrepo, phases, util as hgutil
from edenscm.mercurial.repository import peer as peerrepository
from . import svnmeta, svnwrap, util, wrappers
peerapi = 1

View File

@ -8,17 +8,19 @@ available implementation without the user having to configure what is actually
present.
"""
from __future__ import absolute_import
import os
from common import *
from .common import *
choice = os.environ.get("HGSUBVERSION_BINDINGS", "").lower()
if choice == "subvertpy":
from subvertpy_wrapper import *
from .subvertpy_wrapper import *
elif choice == "swig":
from svn_swig_wrapper import *
from .svn_swig_wrapper import *
elif choice == "none":
# useful for verifying that demandimport works properly
raise ImportError(
@ -26,10 +28,10 @@ elif choice == "none":
)
else:
try:
from subvertpy_wrapper import *
from .subvertpy_wrapper import *
except ImportError as e1:
try:
from svn_swig_wrapper import *
from .svn_swig_wrapper import *
except ImportError as e2:
raise ImportError(
"no compatible bindings available:\n\n"

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import ConfigParser
import fnmatch
import os

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import collections
import cStringIO
import errno
@ -7,7 +9,7 @@ import os
import urllib
import warnings
import common
from . import common
warnings.filterwarnings("ignore", module="svn.core", category=DeprecationWarning)

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import collections
import cStringIO
import errno
@ -10,7 +12,7 @@ import tempfile
import urllib
import warnings
import common
from . import common
warnings.filterwarnings("ignore", module="svn.core", category=DeprecationWarning)

View File

@ -1,14 +1,17 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import gc
import json
import os
import re
import urllib
import compathacks
from edenscm.mercurial import error, hg, node, repair, util as hgutil
from . import compathacks
try:
xrange(0)

View File

@ -1,13 +1,14 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import difflib
import posixpath
import svnrepo
import svnwrap
import util
from edenscm.mercurial import error, progress, util as hgutil, worker
from . import svnrepo, svnwrap, util
def verify(ui, repo, args=None, **opts):
"""verify current revision against Subversion repository

View File

@ -1,6 +1,7 @@
# no-check-code -- see T24862348
# isort:skip_file
from __future__ import absolute_import
import inspect
import os
@ -25,11 +26,11 @@ from edenscm.mercurial import i18n
from edenscm.mercurial import extensions
from edenscm.mercurial import scmutil
import replay
import pushmod
import stupid as stupidmod
import svnwrap
import util
from . import replay
from . import pushmod
from . import stupid as stupidmod
from . import svnwrap
from . import util
try:
from edenscm.mercurial import obsolete

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import sys

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import sys

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import sys

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import sys

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import sys

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import sys

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import sys

View File

@ -1,5 +1,7 @@
# Copyright 2004-present Facebook. All Rights Reserved.
from __future__ import absolute_import
import errno
import os
import time

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import os
import time
import unittest

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import unittest
import silenttestrunner

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import os
import sys

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import shutil
import sys
import tempfile

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util
from edenscm.hgext.hgsubversion import wrappers

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import test_hgsubversion_util
@ -121,9 +123,9 @@ class TestFetchExternals(test_hgsubversion_util.TestBase):
ref1 = """\
[.]
# A comment, then an empty line, then a blank line
^/externals/project1 deps/project1
-r2 ^/externals/project2@2 deps/project2
"""
self.assertMultiLineEqual(ref1, repo[1][".hgsvnexternals"].data())

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import unittest
from edenscm.hgext.hgsubversion import stupid

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import urllib

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import test_hgsubversion_util
from edenscm.mercurial import node

View File

@ -1,7 +1,7 @@
# no-check-code -- see T24862348
"""Tests for author maps and file maps.
"""
from __future__ import absolute_import
import os
import test_hgsubversion_util
@ -9,6 +9,10 @@ from edenscm.hgext.hgsubversion import maps, svncommands, verify
from edenscm.mercurial import commands, node
"""Tests for author maps and file maps.
"""
class MapTests(test_hgsubversion_util.TestBase):
stupid_mode_tests = True

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import sys
import test_hgsubversion_util

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import test_hgsubversion_util

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util
from edenscm.mercurial import commands, hg

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util
from edenscm.mercurial import hg

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import os
import unittest

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util
from edenscm.mercurial import commands, hg

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import edenscm.mercurial as mercurial
import test_hgsubversion_util
from edenscm.hgext.hgsubversion import stupid

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util
from edenscm.hgext.hgsubversion import verify
from edenscm.mercurial import commands, node, util as hgutil

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import os
import test_hgsubversion_util

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import errno
import os
import random

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import test_hgsubversion_util

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util

View File

@ -1,6 +1,8 @@
# no-check-code -- see T24862348
# @nolint
from __future__ import absolute_import
import sys
import test_hgsubversion_util

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import test_hgsubversion_util
from edenscm.hgext.hgsubversion import maps, svnmeta

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import shutil
import test_hgsubversion_util

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import errno
import test_hgsubversion_util

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import test_hgsubversion_util

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import subprocess
import tempfile

View File

@ -1,6 +1,8 @@
# no-check-code -- see T24862348
# @nolint
from __future__ import absolute_import
import cStringIO
import difflib
import os

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import test_hgsubversion_util
from edenscm.mercurial import commands, error, ui

View File

@ -1,5 +1,7 @@
# @nolint
from __future__ import absolute_import
import os
import test_hgsubversion_util

View File

@ -1,5 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import urllib
import test_hgsubversion_util

View File

@ -1,4 +1,7 @@
# no-check-code -- see T24862348
from __future__ import absolute_import
import os
import re

View File

@ -1,6 +1,8 @@
# no-check-code -- see T24862348
# flake8: noqa
from __future__ import absolute_import
import difflib
import errno
import gettext