Provide equivalent of core module.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 15 Jun 2008 01:08:06 +0000 (03:08 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 15 Jun 2008 01:08:06 +0000 (03:08 +0200)
branch.py
commit.py
core.py [new file with mode: 0644]
logwalker.py
remote.py
repository.py
tests/test_radir.py
tree.py
workingtree.py

index 4da6fe9b902551d35702d9f3e54e8e54406c9e94..b671b3b1cbc8366f5593b344d0ab61df70caaa14 100644 (file)
--- a/branch.py
+++ b/branch.py
@@ -27,6 +27,7 @@ from bzrlib.workingtree import WorkingTree
 import svn.client, svn.core
 from svn.core import SubversionException
 
+from bzrlib.plugins.svn import core
 from bzrlib.plugins.svn.commit import push
 from bzrlib.plugins.svn.config import BranchConfig
 from bzrlib.plugins.svn.errors import NotSvnBranchPath, ERR_FS_NO_SUCH_REVISION
@@ -78,7 +79,7 @@ class SvnBranch(Branch):
             if revnum is None:
                 raise NotBranchError(self.base)
             if self.repository.transport.check_path(branch_path.strip("/"), 
-                revnum) != svn.core.svn_node_dir:
+                revnum) != core.NODE_DIR:
                 raise NotBranchError(self.base)
         except SubversionException, (_, num):
             if num == ERR_FS_NO_SUCH_REVISION:
index ed32e6cc06c31502ac6600581a5a779d0379be95..341cdd481b0c3574b0212b9a9114814e35061175 100644 (file)
--- a/commit.py
+++ b/commit.py
@@ -27,7 +27,7 @@ from bzrlib.repository import RootCommitBuilder, InterRepository
 from bzrlib.revision import NULL_REVISION
 from bzrlib.trace import mutter, warning
 
-from bzrlib.plugins.svn import properties
+from bzrlib.plugins.svn import core, properties
 
 from cStringIO import StringIO
 from bzrlib.plugins.svn.errors import ChangesRootLHSHistory, MissingPrefix, RevpropChangeFailed, ERR_FS_TXN_OUT_OF_DATE, ERR_REPOS_DISABLED_FEATURE
@@ -65,7 +65,7 @@ def _check_dirs_exist(transport, bp_parts, base_rev):
     for i in range(len(bp_parts), 0, -1):
         current = bp_parts[:i]
         path = "/".join(current).strip("/")
-        if transport.check_path(path, base_rev) == svn.core.svn_node_dir:
+        if transport.check_path(path, base_rev) == core.NODE_DIR:
             return current
     return []
 
diff --git a/core.py b/core.py
new file mode 100644 (file)
index 0000000..afc4f78
--- /dev/null
+++ b/core.py
@@ -0,0 +1,20 @@
+# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+NODE_NONE = 0
+NODE_FILE = 1
+NODE_DIR = 2
+NODE_UNKNOWN = 3
index 30ee898e13b988794e39ed1bc8f323c0ea3fdf1f..1f4ab1168aac7a4b15df6c34d152092e1ed5c002 100644 (file)
@@ -24,8 +24,8 @@ from svn.core import SubversionException, Pool
 from transport import SvnRaTransport
 import svn.core
 
+from bzrlib.plugins.svn import changes, core
 from bzrlib.plugins.svn.cache import CacheTable
-from bzrlib.plugins.svn import changes
 from bzrlib.plugins.svn.errors import ERR_FS_NO_SUCH_REVISION, ERR_FS_NOT_FOUND
 
 LOG_CHUNK_LIMIT = 0
@@ -397,9 +397,9 @@ class LogWalker(object):
         conn = self._transport.connections.get(self._transport.get_svn_repos_root())
         try:
             ft = conn.check_path(path, revnum)
-            if ft == svn.core.svn_node_file:
+            if ft == core.NODE_FILE:
                 return []
-            assert ft == svn.core.svn_node_dir
+            assert ft == core.NODE_DIR
         finally:
             self._transport.connections.add(conn)
 
index 9c5c5de7f0f83e4fe612a0ccc8678228adc367eb..796b4d74d82b4b738ccb823db169c6907d59730c 100644 (file)
--- a/remote.py
+++ b/remote.py
@@ -25,6 +25,7 @@ from bzrlib.transport.local import LocalTransport
 from svn.core import SubversionException
 import svn.core, svn.repos
 
+from bzrlib.plugins.svn import core
 from bzrlib.plugins.svn.errors import NoSvnRepositoryPresent
 from bzrlib.plugins.svn.format import get_rich_root_format, SvnRemoteFormat
 from bzrlib.plugins.svn.repository import SvnRepository
@@ -127,7 +128,7 @@ class SvnRemoteAccess(BzrDir):
             full_branch_url = urlutils.join(repos.transport.base, 
                                             target_branch_path)
             if repos.transport.check_path(target_branch_path,
-                repos.get_latest_revnum()) != svn.core.svn_node_none:
+                repos.get_latest_revnum()) != core.NODE_NONE:
                 raise AlreadyBranchError(full_branch_url)
             push_new(repos, target_branch_path, source, stop_revision)
         finally:
index 79dcb80f5324f6f6034090158c11f38d7d5f08b4..18bc8d89df4797d6cf01de25769eea8dd742c3e1 100644 (file)
@@ -34,9 +34,9 @@ import svn.core
 
 import os
 
+from bzrlib.plugins.svn import changes, core
 from bzrlib.plugins.svn.branchprops import PathPropertyProvider
 from bzrlib.plugins.svn.cache import create_cache_dir, sqlite3
-from bzrlib.plugins.svn import changes
 from bzrlib.plugins.svn.changes import changes_path, find_prev_location
 from bzrlib.plugins.svn.config import SvnRepositoryConfig
 from bzrlib.plugins.svn.parents import SqliteCachingParentsProvider
@@ -378,7 +378,7 @@ class SvnRepository(Repository):
             return False
 
         try:
-            return (svn.core.svn_node_dir == self.transport.check_path(path, revnum))
+            return (core.NODE_DIR == self.transport.check_path(path, revnum))
         except SubversionException, (_, num):
             if num == errors.ERR_FS_NO_SUCH_REVISION:
                 return False
index 74af0d8bcdc4d7f55b26eb0bca32d3d2d2db7779..7080e16ee5bc65e55cac3bc14c01021dcbc209b6 100644 (file)
@@ -24,6 +24,7 @@ from bzrlib.errors import (NoRepositoryPresent, NotBranchError, NotLocalUrl,
 
 import svn
 
+from bzrlib.plugins.svn import core
 from bzrlib.plugins.svn.format import SvnRemoteFormat
 from bzrlib.plugins.svn.tests import TestCaseWithSubversionRepository
 from bzrlib.plugins.svn.transport import SvnRaTransport
@@ -75,7 +76,7 @@ class TestRemoteAccess(TestCaseWithSubversionRepository):
         b = x.create_branch()
         self.assertEquals(repos_url+"/trunk", b.base)
         transport = SvnRaTransport(repos_url)
-        self.assertEquals(svn.core.svn_node_dir
+        self.assertEquals(core.NODE_DIR
                 transport.check_path("trunk", 1))
 
     def test_bad_dir(self):
diff --git a/tree.py b/tree.py
index 578bc07ac3da7d685265271ddd5a71bb842ebcc4..1d3b842ae20f15cd45bcc1d5bbd2b335b5a69f0b 100644 (file)
--- a/tree.py
+++ b/tree.py
@@ -31,7 +31,7 @@ import urllib
 import svn.core, svn.wc, svn.delta
 from svn.core import Pool
 
-from bzrlib.plugins.svn import errors, properties
+from bzrlib.plugins.svn import errors, properties, core
 
 def parse_externals_description(base_url, val):
     """Parse an svn:externals property value.
@@ -330,7 +330,7 @@ class SvnBasisTree(RevisionTree):
 
                 assert entry
                 
-                if entry.kind == svn.core.svn_node_dir:
+                if entry.kind == core.NODE_DIR:
                     subwc = svn.wc.adm_open3(wc, 
                             self.workingtree.abspath(subrelpath), 
                                              False, 0, None)
index e048f5a95ff5dd79ac70f631b5ff9f36e4a6ecd6..a0ecdaccfaa766c3d81a201646c973d0b3290d5f 100644 (file)
@@ -32,7 +32,7 @@ from bzrlib.revisiontree import RevisionTree
 from bzrlib.transport.local import LocalTransport
 from bzrlib.workingtree import WorkingTree, WorkingTreeFormat
 
-from bzrlib.plugins.svn import properties
+from bzrlib.plugins.svn import core, properties
 from bzrlib.plugins.svn.branch import SvnBranch
 from bzrlib.plugins.svn.commit import _revision_id_to_svk_feature
 from bzrlib.plugins.svn.convert import SvnConverter
@@ -120,7 +120,7 @@ class SvnWorkingTree(WorkingTree):
                     continue
 
                 # Ignore ignores on things that aren't directories
-                if entries[entry].kind != svn.core.svn_node_dir:
+                if entries[entry].kind != core.NODE_DIR:
                     continue
 
                 subprefix = os.path.join(prefix, entry)
@@ -332,7 +332,7 @@ class SvnWorkingTree(WorkingTree):
                 entry = entries[name]
                 assert entry
                 
-                if entry.kind == svn.core.svn_node_dir:
+                if entry.kind == core.NODE_DIR:
                     subwc = svn.wc.adm_open3(wc, self.abspath(subrelpath), 
                                              False, 0, None)
                     try: