# HG changeset patch # User Augie Fackler # Date 1242268779 18000 # Node ID 46e69be8e2c8b6a20dc6dd2a42b358e9a2dd3c4b # Parent c0b943cef0c33034acc99a6ceb0e3832e6d3682a Reorganize to have a more conventional module structure. This means that hgsubversion now uses absolute imports instead of relative ones, which makes the tests more reliable. diff --git a/__init__.py b/hgsubversion/__init__.py rename from __init__.py rename to hgsubversion/__init__.py --- a/__init__.py +++ b/hgsubversion/__init__.py @@ -87,14 +87,14 @@ def uisetup(ui): 'name mapping used for sources)'), ('T', 'tagpaths', ['tags'], 'list of paths to search for tags ' 'in Subversion repositories.')) - extname = __package__.split('_')[-1] + extname = 'hgsubversion' for command in ['clone']: doc = wrapper.__doc__.strip() % { 'extension': extname } getattr(commands, command).__doc__ += doc entry = extensions.wrapcommand(commands.table, command, wrapper) entry[1].extend(newflags) - + try: rebase = extensions.find('rebase') if rebase: diff --git a/cmdutil.py b/hgsubversion/cmdutil.py rename from cmdutil.py rename to hgsubversion/cmdutil.py diff --git a/hg_delta_editor.py b/hgsubversion/hg_delta_editor.py rename from hg_delta_editor.py rename to hgsubversion/hg_delta_editor.py diff --git a/maps.py b/hgsubversion/maps.py rename from maps.py rename to hgsubversion/maps.py diff --git a/stupid.py b/hgsubversion/stupid.py rename from stupid.py rename to hgsubversion/stupid.py diff --git a/svncommands.py b/hgsubversion/svncommands.py rename from svncommands.py rename to hgsubversion/svncommands.py diff --git a/svnexternals.py b/hgsubversion/svnexternals.py rename from svnexternals.py rename to hgsubversion/svnexternals.py diff --git a/svnrepo.py b/hgsubversion/svnrepo.py rename from svnrepo.py rename to hgsubversion/svnrepo.py diff --git a/svnwrap/__init__.py b/hgsubversion/svnwrap/__init__.py rename from svnwrap/__init__.py rename to hgsubversion/svnwrap/__init__.py diff --git a/svnwrap/svn_ctypes_wrapper.py b/hgsubversion/svnwrap/svn_ctypes_wrapper.py rename from svnwrap/svn_ctypes_wrapper.py rename to hgsubversion/svnwrap/svn_ctypes_wrapper.py diff --git a/svnwrap/svn_swig_wrapper.py b/hgsubversion/svnwrap/svn_swig_wrapper.py rename from svnwrap/svn_swig_wrapper.py rename to hgsubversion/svnwrap/svn_swig_wrapper.py diff --git a/svnwrap/tests/__init__.py b/hgsubversion/svnwrap/tests/__init__.py rename from svnwrap/tests/__init__.py rename to hgsubversion/svnwrap/tests/__init__.py diff --git a/svnwrap/tests/fixtures/project_root_at_repo_root.svndump b/hgsubversion/svnwrap/tests/fixtures/project_root_at_repo_root.svndump rename from svnwrap/tests/fixtures/project_root_at_repo_root.svndump rename to hgsubversion/svnwrap/tests/fixtures/project_root_at_repo_root.svndump diff --git a/svnwrap/tests/fixtures/project_root_not_repo_root.svndump b/hgsubversion/svnwrap/tests/fixtures/project_root_not_repo_root.svndump rename from svnwrap/tests/fixtures/project_root_not_repo_root.svndump rename to hgsubversion/svnwrap/tests/fixtures/project_root_not_repo_root.svndump diff --git a/svnwrap/tests/test_svnwrap.py b/hgsubversion/svnwrap/tests/test_svnwrap.py rename from svnwrap/tests/test_svnwrap.py rename to hgsubversion/svnwrap/tests/test_svnwrap.py diff --git a/util.py b/hgsubversion/util.py rename from util.py rename to hgsubversion/util.py diff --git a/utility_commands.py b/hgsubversion/utility_commands.py rename from utility_commands.py rename to hgsubversion/utility_commands.py diff --git a/wrappers.py b/hgsubversion/wrappers.py rename from wrappers.py rename to hgsubversion/wrappers.py diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -23,8 +23,7 @@ setup( long_description = open(os.path.join(os.path.dirname(__file__), 'README')).read(), keywords = 'mercurial', - packages = ['hgext.hgsubversion', 'hgext.hgsubversion.svnwrap'], - package_dir = {'hgext.hgsubversion': ''}, + packages = ['hgsubversion', 'hgsubversion.svnwrap'], platforms = 'any', classifiers = [ 'License :: OSI Approved :: GNU General Public License (GPL)', diff --git a/tests/run.py b/tests/run.py --- a/tests/run.py +++ b/tests/run.py @@ -2,7 +2,7 @@ import os import sys import unittest -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import test_binaryfiles import test_diff diff --git a/tests/test_diff.py b/tests/test_diff.py --- a/tests/test_diff.py +++ b/tests/test_diff.py @@ -2,7 +2,7 @@ import unittest from mercurial import ui -import wrappers +from hgsubversion import wrappers import test_util diff --git a/tests/test_externals.py b/tests/test_externals.py --- a/tests/test_externals.py +++ b/tests/test_externals.py @@ -2,7 +2,7 @@ import os, unittest from mercurial import commands -import svnexternals +from hgsubversion import svnexternals import test_util class TestFetchExternals(test_util.TestBase): @@ -47,7 +47,7 @@ class TestFetchExternals(test_util.TestB ('http://svn.example.com/skin-maker@21 third-party/skins/toolkit', ('third-party/skins/toolkit', None, 'http://svn.example.com/skin-maker', '21')), ] - + for line, expected in samples: self.assertEqual(expected, svnexternals.parsedefinition(line)) @@ -106,7 +106,7 @@ class TestFetchExternals(test_util.TestB svnexternals.updateexternals(ui, [rev], repo) for d in deps: p = os.path.join(repo.root, d) - self.assertTrue(os.path.isdir(p), + self.assertTrue(os.path.isdir(p), 'missing: %s@%r' % (d, rev)) for d in nodeps: p = os.path.join(repo.root, d) @@ -118,10 +118,10 @@ class TestFetchExternals(test_util.TestB commands.update(ui, repo) checkdeps(['deps/project1'], [], repo, 0) checkdeps(['deps/project1', 'deps/project2'], [], repo, 1) - checkdeps(['subdir/deps/project1', 'subdir2/deps/project1', - 'deps/project2'], + checkdeps(['subdir/deps/project1', 'subdir2/deps/project1', + 'deps/project2'], ['deps/project1'], repo, 2) - checkdeps(['subdir/deps/project1', 'deps/project2'], + checkdeps(['subdir/deps/project1', 'deps/project2'], ['subdir2/deps/project1'], repo, 3) checkdeps(['subdir/deps/project1'], ['deps/project2'], repo, 4) diff --git a/tests/test_fetch_branches.py b/tests/test_fetch_branches.py --- a/tests/test_fetch_branches.py +++ b/tests/test_fetch_branches.py @@ -74,10 +74,10 @@ class TestFetchBranches(test_util.TestBa stupid, noupdate=False) self.assertEqual(repo[None].branch(), 'default') self.assertTrue('tip' not in repo[None].tags()) - + def test_branch_tip_update_to_default_stupid(self): self.test_branch_tip_update_to_default(True) - + def test_branch_tip_update_to_branch_anchor(self): repo = self._load_fixture_and_fetch_with_anchor( 'unorderedbranch.svndump', 'branch') diff --git a/tests/test_fetch_command_regexes.py b/tests/test_fetch_command_regexes.py --- a/tests/test_fetch_command_regexes.py +++ b/tests/test_fetch_command_regexes.py @@ -1,6 +1,8 @@ -import stupid import unittest +from hgsubversion import stupid + + two_empties = """Index: __init__.py =================================================================== Index: bar/__init__.py diff --git a/tests/test_push_command.py b/tests/test_push_command.py --- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -63,6 +63,8 @@ class PushTests(test_util.TestBase): self.svnserve_pid = subprocess.Popen(args).pid try: time.sleep(2) + import shutil + shutil.rmtree(self.wc_path) commands.clone(ui.ui(), 'svn://%s:%d/' % (self.host, self.port), self.wc_path, noupdate=True) diff --git a/tests/test_rebuildmeta.py b/tests/test_rebuildmeta.py --- a/tests/test_rebuildmeta.py +++ b/tests/test_rebuildmeta.py @@ -5,8 +5,8 @@ import unittest from mercurial import hg from mercurial import ui -import svncommands -import hg_delta_editor +from hgsubversion import svncommands +from hgsubversion import hg_delta_editor import test_util diff --git a/tests/test_tags.py b/tests/test_tags.py --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -6,7 +6,7 @@ from mercurial import ui import test_util -import svnrepo +from hgsubversion import svnrepo class TestTags(test_util.TestBase): def _load_fixture_and_fetch(self, fixture_name, stupid=False): diff --git a/tests/test_urls.py b/tests/test_urls.py --- a/tests/test_urls.py +++ b/tests/test_urls.py @@ -1,6 +1,6 @@ import test_util import unittest -from svnwrap.svn_swig_wrapper import parse_url +from hgsubversion.svnwrap.svn_swig_wrapper import parse_url class TestSubversionUrls(test_util.TestBase): def test_standard_url(self): diff --git a/tests/test_util.py b/tests/test_util.py --- a/tests/test_util.py +++ b/tests/test_util.py @@ -14,7 +14,7 @@ from mercurial import hg from mercurial import node from mercurial import ui -import util +from hgsubversion import util # Fixtures that need to be pulled at a subdirectory of the repo path subdir = {'truncatedhistory.svndump': '/project2', @@ -50,7 +50,7 @@ def load_fixture_and_fetch(fixture_name, load_svndump_fixture(repo_path, fixture_name) if subdir: repo_path += '/' + subdir - + _ui = ui.ui() _ui.setconfig('hgsubversion', 'stupid', str(stupid)) commands.clone(_ui, fileurl(repo_path), wc_path, noupdate=noupdate) diff --git a/tests/test_utility_commands.py b/tests/test_utility_commands.py --- a/tests/test_utility_commands.py +++ b/tests/test_utility_commands.py @@ -8,10 +8,10 @@ from mercurial import revlog from mercurial import context from mercurial import node -import util -import utility_commands +from hgsubversion import util +from hgsubversion import utility_commands import test_util -import wrappers +from hgsubversion import wrappers expected_info_output = '''URL: %(repourl)s/%(branch)s Repository Root: %(repourl)s @@ -174,7 +174,7 @@ class UtilityTests(test_util.TestBase): def test_genignore(self): """ Test generation of .hgignore file. """ - test_util.load_fixture_and_fetch('ignores.svndump', self.repo_path, + test_util.load_fixture_and_fetch('ignores.svndump', self.repo_path, self.wc_path, noupdate=False) u = ui.ui() u.pushbuffer()