def test_some(self): # Verify ancestors are included. branch = self.make_branch('test') tree = branch.bzrdir.create_workingtree() tree.commit('msg a', rev_id='A') tree.commit('msg b', rev_id='B') tree.commit('msg c', rev_id='C') self.assertEqual(set(['A']), get_ancestry(branch.repository, 'A')) self.assertEqual(set(['A', 'B']), get_ancestry(branch.repository, 'B')) self.assertEqual(set(['A', 'B', 'C']), get_ancestry(branch.repository, 'C'))
def test_some(self): # Verify ancestors are included. branch = self.make_branch('test') tree = branch.bzrdir.create_workingtree() tree.commit('msg a', rev_id='A') tree.commit('msg b', rev_id='B') tree.commit('msg c', rev_id='C') self.assertEqual( set(['A']), get_ancestry(branch.repository, 'A')) self.assertEqual( set(['A', 'B']), get_ancestry(branch.repository, 'B')) self.assertEqual( set(['A', 'B', 'C']), get_ancestry(branch.repository, 'C'))
def test_children(self): # Verify non-mainline children are included. branch = self.make_branch('test') tree = branch.bzrdir.create_workingtree() tree.commit('msg a', rev_id='A') branch.generate_revision_history(NULL_REVISION) tree.set_parent_ids([]) tree.commit('msg b', rev_id='B') branch.generate_revision_history('A') tree.set_parent_ids(['A', 'B']) tree.commit('msg c', rev_id='C') self.assertEqual(set(['A']), get_ancestry(branch.repository, 'A')) self.assertEqual(set(['B']), get_ancestry(branch.repository, 'B')) self.assertEqual(set(['A', 'B', 'C']), get_ancestry(branch.repository, 'C'))
def test_children(self): # Verify non-mainline children are included. branch = self.make_branch('test') tree = branch.bzrdir.create_workingtree() tree.commit('msg a', rev_id='A') branch.generate_revision_history(NULL_REVISION) tree.set_parent_ids([]) tree.commit('msg b', rev_id='B') branch.generate_revision_history('A') tree.set_parent_ids(['A', 'B']) tree.commit('msg c', rev_id='C') self.assertEqual( set(['A']), get_ancestry(branch.repository, 'A')) self.assertEqual( set(['B']), get_ancestry(branch.repository, 'B')) self.assertEqual( set(['A', 'B', 'C']), get_ancestry(branch.repository, 'C'))
def getAncestryDelta(self, bzr_branch): bzr_last = bzr_branch.last_revision() db_last = self.db_branch.last_scanned_id if db_last is None: added_ancestry = get_ancestry(bzr_branch.repository, bzr_last) removed_ancestry = set() else: graph = self._getRevisionGraph(bzr_branch, db_last) added_ancestry, removed_ancestry = (graph.find_difference( bzr_last, db_last)) added_ancestry.discard(NULL_REVISION) return added_ancestry, removed_ancestry
def getAncestryDelta(self, bzr_branch): bzr_last = bzr_branch.last_revision() db_last = self.db_branch.last_scanned_id if db_last is None: added_ancestry = get_ancestry(bzr_branch.repository, bzr_last) removed_ancestry = set() else: graph = self._getRevisionGraph(bzr_branch, db_last) added_ancestry, removed_ancestry = ( graph.find_difference(bzr_last, db_last)) added_ancestry.discard(NULL_REVISION) return added_ancestry, removed_ancestry