def test_get_branches(self): client = SvnClient(self.local_path) self.assertEqual(['foo'], client.get_branches()) # slyly create some empty branches subprocess.check_call("mkdir %s" % os.path.normpath("branches/foo2"), shell=True, cwd=self.init_path) subprocess.check_call("mkdir %s" % os.path.normpath("branches/bar"), shell=True, cwd=self.init_path) subprocess.check_call("svn add branches/foo2", shell=True, cwd=self.init_path) subprocess.check_call("svn add branches/bar", shell=True, cwd=self.init_path) subprocess.check_call("svn commit -m newbranches", shell=True, cwd=self.init_path) self.assertEqual([], client.get_branches(local_only=True)) self.assertEqual(['bar', 'foo', 'foo2'], client.get_branches()) # checkout branch foo local_path2 = os.path.join(self.root_directory, "local_foo") client = SvnClient(local_path2) client.checkout(self.local_root_url + '/branches/foo') self.assertEqual(['foo'], client.get_branches(local_only=True))
def test_get_branches_non_canonical(self): remote_path = os.path.join(self.root_directory, "remote_nc") init_path = os.path.join(self.root_directory, "init_nc") local_path = os.path.join(self.root_directory, "local_nc") # create a "remote" repo subprocess.check_call("svnadmin create %s" % remote_path, shell=True, cwd=self.root_directory) local_root_url = _get_file_uri(remote_path) local_url = local_root_url + "/footest" # create an "init" repo to populate remote repo subprocess.check_call("svn checkout %s %s" % (local_root_url, init_path), shell=True, cwd=self.root_directory) for cmd in [ "mkdir footest", "mkdir %s" % os.path.normpath("footest/foosub") ]: subprocess.check_call(cmd, shell=True, cwd=init_path) _touch(os.path.join(init_path, "footest/foosub/fixed.txt")) for cmd in ["svn add footest", "svn commit -m initial"]: subprocess.check_call(cmd, shell=True, cwd=init_path) client = SvnClient(local_path) client.checkout(local_url) self.assertEqual([], client.get_branches())
def test_get_branches(self): client = SvnClient(self.local_path) self.assertEqual(['foo'], client.get_branches()) # slyly create some empty branches subprocess.check_call("mkdir -p branches/foo2", shell=True, cwd=self.init_path) subprocess.check_call("mkdir -p branches/bar", shell=True, cwd=self.init_path) subprocess.check_call("svn add branches/foo2", shell=True, cwd=self.init_path) subprocess.check_call("svn add branches/bar", shell=True, cwd=self.init_path) subprocess.check_call("svn commit -m newbranches", shell=True, cwd=self.init_path) self.assertEqual([], client.get_branches(local_only=True)) self.assertEqual(['bar', 'foo', 'foo2'], client.get_branches()) # checkout branch foo local_path2 = os.path.join(self.root_directory, "local_foo") client = SvnClient(local_path2) client.checkout(self.local_root_url + '/branches/foo') self.assertEqual(['foo'], client.get_branches(local_only=True))
def test_get_branches_non_canonical(self): remote_path = os.path.join(self.root_directory, "remote_nc") init_path = os.path.join(self.root_directory, "init_nc") local_path = os.path.join(self.root_directory, "local_nc") # create a "remote" repo subprocess.check_call("svnadmin create %s" % remote_path, shell=True, cwd=self.root_directory) local_root_url = "file://localhost/" + remote_path local_url = local_root_url + "/footest" # create an "init" repo to populate remote repo subprocess.check_call("svn checkout %s %s" % (local_root_url, init_path), shell=True, cwd=self.root_directory) for cmd in [ "mkdir footest", "mkdir footest/foosub", "touch footest/foosub/fixed.txt", "svn add footest", "svn commit -m initial"]: subprocess.check_call(cmd, shell=True, cwd=init_path) client = SvnClient(local_path) client.checkout(local_url) self.assertEqual([], client.get_branches())