def test_info(self): """Test svn_client_info on an empty repository""" # Run info revt = core.svn_opt_revision_t() revt.kind = core.svn_opt_revision_head client.info(self.repos_uri, revt, revt, self.info_receiver, False, self.client_ctx) # Check output from running info. This also serves to verify that # the internal 'info' object is still valid self.assertEqual(self.path, os.path.basename(self.repos_path)) self.info.assert_valid() self.assertEqual(self.info.URL, self.repos_uri) self.assertEqual(self.info.repos_root_URL, self.repos_uri)
def test_info(self): """Test scope of get_logs callbacks""" # Run info revt = core.svn_opt_revision_t() revt.kind = core.svn_opt_revision_head client.info(REPOS_URL, revt, revt, self.info_receiver, False, self.client_ctx) # Check output from running info. This also serves to verify that # the internal 'info' object is still valid self.assertEqual(self.path, os.path.basename(REPOS_PATH)) self.info.assert_valid() self.assertEqual(self.info.URL, REPOS_URL) self.assertEqual(self.info.repos_root_URL, REPOS_URL)
def test_info_file(self): """Test svn_client_info on working copy file and remote files.""" # This test requires a file /trunk/README.txt of size 8 bytes # in the repository. rev = core.svn_opt_revision_t() rev.kind = core.svn_opt_revision_head wc_path = core.svn_path_canonicalize(tempfile.mktemp()) client.checkout2(REPOS_URL, wc_path, rev, rev, True, True, self.client_ctx) adm_access = wc.adm_open3(None, wc_path, True, -1, None) try: # Test 1: Run info -r BASE. We expect the size value to be filled in. rev.kind = core.svn_opt_revision_base readme_path = '%s/trunk/README.txt' % wc_path readme_url = '%s/trunk/README.txt' % REPOS_URL client.info(readme_path, rev, rev, self.info_receiver, False, self.client_ctx) self.assertEqual(self.path, os.path.basename(readme_path)) self.info.assert_valid() self.assertEqual(self.info.working_size, client.SWIG_SVN_INFO_SIZE_UNKNOWN) self.assertEqual(self.info.size, 8) # Test 2: Run info (revision unspecified). We expect the working_size value # to be filled in. rev.kind = core.svn_opt_revision_unspecified client.info(readme_path, rev, rev, self.info_receiver, False, self.client_ctx) self.assertEqual(self.path, readme_path) self.info.assert_valid() self.assertEqual(self.info.size, client.SWIG_SVN_INFO_SIZE_UNKNOWN) # README.txt contains one EOL char, so on Windows it will be expanded from # LF to CRLF hence the working_size will be 9 instead of 8. if os.name == 'nt': self.assertEqual(self.info.working_size, 9) else: self.assertEqual(self.info.working_size, 8) # Test 3: Run info on the repository URL of README.txt. We expect the size # value to be filled in. rev.kind = core.svn_opt_revision_head client.info(readme_url, rev, rev, self.info_receiver, False, self.client_ctx) self.info.assert_valid() self.assertEqual(self.info.working_size, client.SWIG_SVN_INFO_SIZE_UNKNOWN) self.assertEqual(self.info.size, 8) finally: wc.adm_close(adm_access) core.svn_io_remove_dir(wc_path)