def test_checkout_specific_branch_and_update(self): from vcstools.git import GitClient directory = tempfile.mkdtemp() subdir = "checkout_specific_version_test" self.directories[subdir] = directory local_path = os.path.join(directory, "ros") url = self.readonly_url branch = "master" client = GitClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(url, branch)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), url) self.assertEqual(client.get_branch_parent(), branch) new_branch = 'master' self.assertTrue(client.update(new_branch)) self.assertEqual(client.get_branch_parent(), new_branch) shutil.rmtree(directory) self.directories.pop(subdir)
def test_checkout(self): from vcstools.git import GitClient directory = tempfile.mkdtemp() self.directories["checkout_test"] = directory local_path = os.path.join(directory, "ros") url = self.readonly_url client = GitClient(local_path) self.assertFalse(client.path_exists()) self.assertFalse(client.detect_presence()) self.assertFalse(client.detect_presence()) self.assertTrue(client.checkout(url)) self.assertTrue(client.path_exists()) self.assertTrue(client.detect_presence()) self.assertEqual(client.get_path(), local_path) self.assertEqual(client.get_url(), url) self.assertEqual(client.get_branch(), "master") self.assertEqual(client.get_branch_parent(), "master") #self.assertEqual(client.get_version(), '-r*') shutil.rmtree(directory) self.directories.pop("checkout_test")