def check_subversion_version(): """Check that Subversion is compatible. """ # Installed ? from subvertpy import ra, __version__ as subvertpy_version ra_version = ra.version() if (ra_version[1] >= 5 and getattr(ra, 'SVN_REVISION', None) and 27729 <= ra.SVN_REVISION < 31470): raise DependencyNotPresent( "subvertpy", 'bzr-svn: Installed Subversion has buggy svn.ra.get_log() ' 'implementation, please install newer.') from breezy.trace import mutter versions = ["Subversion %d.%d.%d (%s)" % ra_version] if getattr(ra, "api_version", None) is not None and ra.api_version() != ra_version: versions.append("Subversion API %d.%d.%d (%s)" % ra.api_version()) versions.append("subvertpy %d.%d.%d" % subvertpy_version) mutter("bzr-svn: using " + ", ".join(versions)) if subvertpy_version < subvertpy_minimum_version: raise DependencyNotPresent( "subvertpy", "bzr-svn: at least subvertpy %d.%d.%d is required, %d.%d.%d is installed." % (subvertpy_minimum_version + subvertpy_version))
def test_has_capability(self): if ra.api_version() < (1, 5): self.assertRaises(NotImplementedError, self.ra.has_capability, "FOO") else: self.assertRaises(SubversionException, self.ra.has_capability, "FOO")
def check_results(returned): self.assertEqual(2, len(returned)) self.assertTrue(len(returned[0]) in (3, 4)) if len(returned[0]) == 3: (paths, revnum, props) = returned[0] else: (paths, revnum, props, has_children) = returned[0] self.assertEqual(None, paths) self.assertEqual(revnum, 0) self.assertEqual(["svn:date"], list(props.keys())) if len(returned[1]) == 3: (paths, revnum, props) = returned[1] else: (paths, revnum, props, has_children) = returned[1] if ra.api_version() < (1, 6): self.assertEqual({"/foo": ("A", None, -1, NODE_UNKNOWN)}, paths) else: self.assertEqual({"/foo": ("A", None, -1, NODE_DIR)}, paths) self.assertEqual(revnum, 1) self.assertEqual(set(["svn:date", "svn:author", "svn:log"]), set(props.keys()))
def check_results(returned): self.assertEqual(2, len(returned)) self.assertTrue(len(returned[0]) in (3, 4)) if len(returned[0]) == 3: (paths, revnum, props) = returned[0] else: (paths, revnum, props, has_children) = returned[0] self.assertEqual(None, paths) self.assertEqual(revnum, 0) self.assertEqual(["svn:date"], list(props.keys())) if len(returned[1]) == 3: (paths, revnum, props) = returned[1] else: (paths, revnum, props, has_children) = returned[1] if ra.api_version() < (1, 6): self.assertEqual({'/foo': ('A', None, -1, NODE_UNKNOWN)}, paths) else: self.assertEqual({'/foo': ('A', None, -1, NODE_DIR)}, paths) self.assertEqual(revnum, 1) self.assertEqual(set(["svn:date", "svn:author", "svn:log"]), set(props.keys()))
def test_get_url(self): if ra.api_version() < (1, 5): self.assertRaises(NotImplementedError, self.ra.get_session_url) else: self.assertEqual(self.repos_url, self.ra.get_session_url())
def test_api_version_later_same(self): self.assertTrue(ra.api_version() <= ra.version())
def test_api_version_length(self): self.assertEqual(4, len(ra.api_version()))
def test_get_url(self): if ra.api_version() < (1, 5): self.assertRaises(NotImplementedError, self.ra.get_url) else: self.assertEqual(self.repos_url, self.ra.get_url())