def test_find_branches_between_removed(self): repos_url = self.make_svn_repository("a") repos = Repository.open(repos_url) repos.set_layout(TrunkLayout(0)) dc = self.get_commit_editor(repos_url) trunk = dc.add_dir("trunk") trunk.add_file("trunk/foo").modify(b"data") dc.close() dc = self.get_commit_editor(repos_url) dc.delete("trunk") dc.close() self.assertEqual([("trunk", 1, True)], list( find_branches_between(repos._log, repos.transport, TrunkLayout(0), from_revnum=2, to_revnum=0))) self.assertEqual([("trunk", 1, True)], list( find_branches_between(repos._log, repos.transport, TrunkLayout(0), from_revnum=1, to_revnum=0)))
def test_find_branches_between_moved_nobranch(self): repos_url = self.make_client("a", "dc") self.build_tree({ 'dc/tmp/nested/foobar': None, 'dc/tmp/nested/branches/brancha': None, 'dc/tmp/nested/branches/branchab': None, 'dc/tmp/nested/branches/brancha/data': "data", "dc/tmp/nested/branches/branchab/data": "data" }) self.client_add("dc/tmp") self.client_commit("dc", "My Message") self.client_copy("dc/tmp/nested", "dc/t2") self.client_commit("dc", "My Message 2") repos = Repository.open(repos_url) repos.set_layout(TrunkLayout(1)) self.assertEqual([("t2/branches/brancha", 2, True), ("t2/branches/branchab", 2, True)], list( find_branches_between(repos._log, repos.transport, TrunkLayout(1), to_revnum=2, from_revnum=2)))
def test_find_branches_between_deleted_from_nobranch(self): repos_url = self.make_client("a", "dc") self.build_tree({'dc/tmp/trunk': None, 'dc/bla/somefile': "contents"}) self.client_add("dc/tmp") self.client_add("dc/bla") self.client_commit("dc", "My Message") self.client_copy("dc/bla", "dc/tmp/branches") self.client_delete("dc/tmp/branches/somefile") self.client_commit("dc", "My Message 2") repos = Repository.open(repos_url) find_branches_between(repos._log, repos.transport, TrunkLayout(1), from_revnum=2, to_revnum=0)
def test_find_branches_between_trunk_empty(self): repos_url = self.make_svn_repository("a") repos = Repository.open(repos_url) repos.set_layout(TrunkLayout(0)) self.assertEqual([], list( find_branches_between(repos._log, repos.transport, TrunkLayout(0), to_revnum=0, from_revnum=0)))
def test_find_branches_between_no_later(self): repos_url = self.make_svn_repository("a") repos = Repository.open(repos_url) repos.set_layout(RootLayout()) self.assertEqual([("", 0, True)], list( find_branches_between(repos._log, repos.transport, RootLayout(), to_revnum=0, from_revnum=0)))
def test_find_branches_between_start_revno(self): repos_url = self.make_svn_repository("a") dc = self.get_commit_editor(repos_url) branches = dc.add_dir("branches") branches.add_dir("branches/brancha") dc.close() dc = self.get_commit_editor(repos_url) branches = dc.open_dir("branches") branches.add_dir("branches/branchb") dc.close() repos = Repository.open(repos_url) repos.set_layout(TrunkLayout(0)) self.assertEqual([("branches/branchb", 2, True)], list( find_branches_between(repos._log, repos.transport, TrunkLayout(0), from_revnum=2, to_revnum=2)))