def setUp(self): # we want several inventories, that respectively # give use the following scenarios: # A) fileid not in any inventory (A), # B) fileid present in one inventory (B) and (A,B) # C) fileid present in two inventories, and they # are not mutual descendents (B, C) # D) fileid present in two inventories and one is # a descendent of the other. (B, D) super(TestPreviousHeads, self).setUp() self.wt = self.make_branch_and_tree('.') self.branch = self.wt.branch self.build_tree(['file']) self.wt.commit('new branch', allow_pointless=True, rev_id='A') self.inv_A = self.branch.repository.get_inventory('A') self.wt.add(['file'], ['fileid']) self.wt.commit('add file', rev_id='B') self.inv_B = self.branch.repository.get_inventory('B') uncommit(self.branch, tree=self.wt) self.assertEqual(self.branch.revision_history(), ['A']) self.wt.commit('another add of file', rev_id='C') self.inv_C = self.branch.repository.get_inventory('C') self.wt.add_parent_tree_id('B') self.wt.commit('merge in B', rev_id='D') self.inv_D = self.branch.repository.get_inventory('D') self.tree = self.workingtree_to_test_tree(self.wt) self.tree.lock_read() self.addCleanup(self.tree.unlock) self.file_active = get_entry(self.tree, 'fileid')
def test_add_first_parent_id(self): """Test adding the first parent id""" tree = self.make_branch_and_tree('.') first_revision = tree.commit('first post') uncommit(tree.branch, tree=tree) tree.add_parent_tree_id(first_revision) self.assertConsistentParents([first_revision], tree)
def test_uncommit_to_null(self): tree = self.make_branch_and_tree('branch') tree.lock_write() revid = tree.commit('a revision') tree.unlock() uncommit.uncommit(tree.branch, tree=tree) self.assertEqual([], tree.get_parent_ids())
def test_push_remember(self): """Push changes from one branch to another and test push location.""" transport = self.get_transport() tree_a = self.make_branch_and_tree('branch_a') branch_a = tree_a.branch self.build_tree(['branch_a/a']) tree_a.add('a') tree_a.commit('commit a') tree_b = branch_a.bzrdir.sprout('branch_b').open_workingtree() branch_b = tree_b.branch tree_c = branch_a.bzrdir.sprout('branch_c').open_workingtree() branch_c = tree_c.branch self.build_tree(['branch_a/b']) tree_a.add('b') tree_a.commit('commit b') self.build_tree(['branch_b/c']) tree_b.add('c') tree_b.commit('commit c') # initial push location must be empty self.assertEqual(None, branch_b.get_push_location()) # test push for failure without push location set os.chdir('branch_a') out = self.run_bzr('push', retcode=3) self.assertEquals(out, ('','bzr: ERROR: No push location known or specified.\n')) # test not remembered if cannot actually push self.run_bzr('push ../path/which/doesnt/exist', retcode=3) out = self.run_bzr('push', retcode=3) self.assertEquals( ('', 'bzr: ERROR: No push location known or specified.\n'), out) # test implicit --remember when no push location set, push fails out = self.run_bzr('push ../branch_b', retcode=3) self.assertEquals(out, ('','bzr: ERROR: These branches have diverged. ' 'Try using "merge" and then "push".\n')) self.assertEquals(abspath(branch_a.get_push_location()), abspath(branch_b.bzrdir.root_transport.base)) # test implicit --remember after resolving previous failure uncommit(branch=branch_b, tree=tree_b) transport.delete('branch_b/c') out, err = self.run_bzr('push') path = branch_a.get_push_location() self.assertEquals(out, 'Using saved location: %s\n' 'Pushed up to revision 2.\n' % local_path_from_url(path)) self.assertEqual(err, 'All changes applied successfully.\n') self.assertEqual(path, branch_b.bzrdir.root_transport.base) # test explicit --remember self.run_bzr('push ../branch_c --remember') self.assertEquals(branch_a.get_push_location(), branch_c.bzrdir.root_transport.base)
def test_set_two_parents_one_ghost_ids(self): t = self.make_branch_and_tree('.') revision_in_repo = t.commit('first post') # remove the tree's history uncommit(t.branch, tree=t) rev_tree = t.branch.repository.revision_tree(revision_in_repo) t.set_parent_ids([revision_in_repo, 'another-missing']) self.assertConsistentParents([revision_in_repo, 'another-missing'], t)
def test_add_second_parent_tree(self): """Test adding the second parent id""" tree = self.make_branch_and_tree('.') first_revision = tree.commit('first post') uncommit(tree.branch, tree=tree) second_revision = tree.commit('second post') tree.add_parent_tree((first_revision, tree.branch.repository.revision_tree(first_revision))) self.assertConsistentParents([second_revision, first_revision], tree)
def test_add_second_parent_tree(self): """Test adding the second parent id""" tree = self.make_branch_and_tree('.') first_revision = tree.commit('first post') uncommit(tree.branch, tree=tree) second_revision = tree.commit('second post') tree.add_parent_tree( (first_revision, tree.branch.repository.revision_tree(first_revision))) self.assertConsistentParents([second_revision, first_revision], tree)
def test_push_remember(self): """Push changes from one branch to another and test push location.""" transport = self.get_transport() tree_a = self.make_branch_and_tree('branch_a') branch_a = tree_a.branch self.build_tree(['branch_a/a']) tree_a.add('a') tree_a.commit('commit a') tree_b = branch_a.bzrdir.sprout('branch_b').open_workingtree() branch_b = tree_b.branch tree_c = branch_a.bzrdir.sprout('branch_c').open_workingtree() branch_c = tree_c.branch self.build_tree(['branch_a/b']) tree_a.add('b') tree_a.commit('commit b') self.build_tree(['branch_b/c']) tree_b.add('c') tree_b.commit('commit c') # initial push location must be empty self.assertEqual(None, branch_b.get_push_location()) # test push for failure without push location set os.chdir('branch_a') out = self.run_bzr('push', retcode=3) self.assertEquals( out, ('', 'bzr: ERROR: No push location known or specified.\n')) # test not remembered if cannot actually push self.run_bzr('push ../path/which/doesnt/exist', retcode=3) out = self.run_bzr('push', retcode=3) self.assertEquals( ('', 'bzr: ERROR: No push location known or specified.\n'), out) # test implicit --remember when no push location set, push fails out = self.run_bzr('push ../branch_b', retcode=3) self.assertEquals(out, ('', 'bzr: ERROR: These branches have diverged. ' 'Try using "merge" and then "push".\n')) self.assertEquals(abspath(branch_a.get_push_location()), abspath(branch_b.bzrdir.root_transport.base)) # test implicit --remember after resolving previous failure uncommit(branch=branch_b, tree=tree_b) transport.delete('branch_b/c') out, err = self.run_bzr('push') path = branch_a.get_push_location() self.assertEquals( out, 'Using saved location: %s\n' 'Pushed up to revision 2.\n' % local_path_from_url(path)) self.assertEqual(err, 'All changes applied successfully.\n') self.assertEqual(path, branch_b.bzrdir.root_transport.base) # test explicit --remember self.run_bzr('push ../branch_c --remember') self.assertEquals(branch_a.get_push_location(), branch_c.bzrdir.root_transport.base)
def test_uncommit_remove_tags(self): tree, history = self.make_linear_tree() self.assertEqual(history[1], tree.last_revision()) self.assertEqual((2, history[1]), tree.branch.last_revision_info()) tree.branch.tags.set_tag(u"pointsatexisting", history[0]) tree.branch.tags.set_tag(u"pointsatremoved", history[1]) uncommit.uncommit(tree.branch, tree=tree) self.assertEqual(history[0], tree.last_revision()) self.assertEqual((1, history[0]), tree.branch.last_revision_info()) self.assertEqual({ "pointsatexisting": history[0] }, tree.branch.tags.get_tag_dict())
def test_uncommit(self): tree, history = self.make_linear_tree() self.assertEqual(history[1], tree.last_revision()) self.assertEqual((2, history[1]), tree.branch.last_revision_info()) uncommit.uncommit(tree.branch, tree=tree) self.assertEqual(history[0], tree.last_revision()) self.assertEqual((1, history[0]), tree.branch.last_revision_info()) # The file should not be removed self.failUnlessExists('tree/two') # And it should still be listed as added self.assertIsNot(None, tree.path2id('two'))
def test_uncommit_branch(self): """RevisionMailJob for removed revisions runs via Celery.""" db_branch, tree = self.prepare('RevisionMailJob') tree.commit('message') bzr_sync = BzrSync(db_branch) with block_on_job(): bzr_sync.syncBranchAndClose(tree.branch) pop_remote_notifications() uncommit(tree.branch) with block_on_job(): bzr_sync.syncBranchAndClose(tree.branch) self.assertEqual(1, len(pop_remote_notifications()))
def test_uncommit(self): tree, history = self.make_linear_tree() self.assertEqual(history[1], tree.last_revision()) self.assertEqual((2, history[1]), tree.branch.last_revision_info()) uncommit.uncommit(tree.branch, tree=tree) self.assertEqual(history[0], tree.last_revision()) self.assertEqual((1, history[0]), tree.branch.last_revision_info()) # The file should not be removed self.assertPathExists('tree/two') # And it should still be listed as added self.assertIsNot(None, tree.path2id('two'))
def test_post_uncommit_to_origin(self): tree = self.make_branch_and_memory_tree('branch') tree.lock_write() tree.add('') revid = tree.commit('a revision') tree.unlock() Branch.hooks.install_named_hook('post_uncommit', self.capture_post_uncommit_hook, None) uncommit(tree.branch) # with nothing left we should still get a notification, and # have the branch locked at notification time. self.assertEqual([('post_uncommit', None, tree.branch.base, 1, revid, 0, None, None, True)], self.hook_calls)
def test_pull_remember(self): """Pull changes from one branch to another and test parent location.""" t = self.get_transport() tree_a = self.make_branch_and_tree('branch_a') branch_a = tree_a.branch self.build_tree(['branch_a/a']) tree_a.add('a') tree_a.commit('commit a') tree_b = branch_a.bzrdir.sprout('branch_b').open_workingtree() branch_b = tree_b.branch tree_c = branch_a.bzrdir.sprout('branch_c').open_workingtree() branch_c = tree_c.branch self.build_tree(['branch_a/b']) tree_a.add('b') tree_a.commit('commit b') # reset parent parent = branch_b.get_parent() branch_b = branch.Branch.open('branch_b') branch_b.set_parent(None) self.assertEqual(None, branch_b.get_parent()) # test pull for failure without parent set out = self.run_bzr('pull', retcode=3, working_dir='branch_b') self.assertEqual(out, ('','bzr: ERROR: No pull location known or specified.\n')) # test implicit --remember when no parent set, this pull conflicts self.build_tree(['branch_b/d']) tree_b.add('d') tree_b.commit('commit d') out = self.run_bzr('pull ../branch_a', retcode=3, working_dir='branch_b') self.assertEqual(out, ('','bzr: ERROR: These branches have diverged.' ' Use the missing command to see how.\n' 'Use the merge command to reconcile them.\n')) tree_b = tree_b.bzrdir.open_workingtree() branch_b = tree_b.branch self.assertEqual(parent, branch_b.get_parent()) # test implicit --remember after resolving previous failure uncommit.uncommit(branch=branch_b, tree=tree_b) t.delete('branch_b/d') self.run_bzr('pull', working_dir='branch_b') # Refresh the branch object as 'pull' modified it branch_b = branch_b.bzrdir.open_branch() self.assertEqual(branch_b.get_parent(), parent) # test explicit --remember self.run_bzr('pull ../branch_c --remember', working_dir='branch_b') # Refresh the branch object as 'pull' modified it branch_b = branch_b.bzrdir.open_branch() self.assertEqual(branch_c.bzrdir.root_transport.base, branch_b.get_parent())
def test_pull_remember(self): """Pull changes from one branch to another and test parent location.""" t = self.get_transport() tree_a = self.make_branch_and_tree('branch_a') branch_a = tree_a.branch self.build_tree(['branch_a/a']) tree_a.add('a') tree_a.commit('commit a') tree_b = branch_a.bzrdir.sprout('branch_b').open_workingtree() branch_b = tree_b.branch tree_c = branch_a.bzrdir.sprout('branch_c').open_workingtree() branch_c = tree_c.branch self.build_tree(['branch_a/b']) tree_a.add('b') tree_a.commit('commit b') # reset parent parent = branch_b.get_parent() branch_b = branch.Branch.open('branch_b') branch_b.set_parent(None) self.assertEqual(None, branch_b.get_parent()) # test pull for failure without parent set out = self.run_bzr('pull', retcode=3, working_dir='branch_b') self.assertEqual( out, ('', 'bzr: ERROR: No pull location known or specified.\n')) # test implicit --remember when no parent set, this pull conflicts self.build_tree(['branch_b/d']) tree_b.add('d') tree_b.commit('commit d') out = self.run_bzr('pull ../branch_a', retcode=3, working_dir='branch_b') self.assertEqual(out, ('', 'bzr: ERROR: These branches have diverged.' ' Use the missing command to see how.\n' 'Use the merge command to reconcile them.\n')) tree_b = tree_b.bzrdir.open_workingtree() branch_b = tree_b.branch self.assertEqual(parent, branch_b.get_parent()) # test implicit --remember after resolving previous failure uncommit.uncommit(branch=branch_b, tree=tree_b) t.delete('branch_b/d') self.run_bzr('pull', working_dir='branch_b') # Refresh the branch object as 'pull' modified it branch_b = branch_b.bzrdir.open_branch() self.assertEqual(branch_b.get_parent(), parent) # test explicit --remember self.run_bzr('pull ../branch_c --remember', working_dir='branch_b') # Refresh the branch object as 'pull' modified it branch_b = branch_b.bzrdir.open_branch() self.assertEqual(branch_c.bzrdir.root_transport.base, branch_b.get_parent())
def test_post_uncommit_not_to_origin(self): tree = self.make_branch_and_memory_tree('branch') tree.lock_write() tree.add('') revid = tree.commit('first revision') revid2 = tree.commit('second revision') revid3 = tree.commit('third revision') tree.unlock() Branch.hooks.install_named_hook('post_uncommit', self.capture_post_uncommit_hook, None) uncommit(tree.branch, revno=2) # having uncommitted from up the branch, we should get the # before and after revnos and revids correctly. self.assertEqual([('post_uncommit', None, tree.branch.base, 3, revid3, 1, revid, None, True)], self.hook_calls)
def test_post_uncommit_to_origin(self): tree = self.make_branch_and_memory_tree('branch') tree.lock_write() tree.add('') revid = tree.commit('a revision') tree.unlock() branch.Branch.hooks.install_named_hook('post_uncommit', self.capture_post_uncommit_hook, None) uncommit.uncommit(tree.branch) # with nothing left we should still get a notification, and # have the branch locked at notification time. self.assertEqual([ ('post_uncommit', None, tree.branch.base, 1, revid, 0, None, None, True) ], self.hook_calls)
def test_uncommit_bound_local(self): tree, history = self.make_linear_tree() child = tree.bzrdir.sprout('child').open_workingtree() child.branch.bind(tree.branch) self.assertEqual(history[1], tree.last_revision()) self.assertEqual((2, history[1]), tree.branch.last_revision_info()) self.assertEqual(history[1], child.last_revision()) self.assertEqual((2, history[1]), child.branch.last_revision_info()) # Uncommit local=True should only affect the local branch uncommit.uncommit(child.branch, tree=child, local=True) self.assertEqual(history[1], tree.last_revision()) self.assertEqual((2, history[1]), tree.branch.last_revision_info()) self.assertEqual(history[0], child.last_revision()) self.assertEqual((1, history[0]), child.branch.last_revision_info())
def test_post_uncommit_not_to_origin(self): tree = self.make_branch_and_memory_tree('branch') tree.lock_write() tree.add('') revid = tree.commit('first revision') revid2 = tree.commit('second revision') revid3 = tree.commit('third revision') tree.unlock() branch.Branch.hooks.install_named_hook( 'post_uncommit', self.capture_post_uncommit_hook, None) uncommit.uncommit(tree.branch, revno=2) # having uncommitted from up the branch, we should get the # before and after revnos and revids correctly. self.assertEqual([ ('post_uncommit', None, tree.branch.base, 3, revid3, 1, revid, None, True) ], self.hook_calls)
def test_uncommit_bound(self): tree, history = self.make_linear_tree() child = tree.bzrdir.sprout('child').open_workingtree() child.branch.bind(tree.branch) self.assertEqual(history[1], tree.last_revision()) self.assertEqual((2, history[1]), tree.branch.last_revision_info()) self.assertEqual(history[1], child.last_revision()) self.assertEqual((2, history[1]), child.branch.last_revision_info()) # Uncommit in a bound branch should uncommit the master branch, but not # touch the other working tree. uncommit.uncommit(child.branch, tree=child) self.assertEqual(history[1], tree.last_revision()) self.assertEqual((1, history[0]), tree.branch.last_revision_info()) self.assertEqual(history[0], child.last_revision()) self.assertEqual((1, history[0]), child.branch.last_revision_info())
def test_uncommit_bound(self): os.mkdir('a') a = BzrDirMetaFormat1().initialize('a') a.create_repository() a.create_branch() t_a = a.create_workingtree() t_a.commit('commit 1') t_a.commit('commit 2') t_a.commit('commit 3') b = t_a.branch.create_checkout('b').branch uncommit.uncommit(b) self.assertEqual(b.last_revision_info()[0], 2) self.assertEqual(t_a.branch.last_revision_info()[0], 2) # update A's tree to not have the uncommitted revision referenced. t_a.update() t_a.commit('commit 3b') self.assertRaises(BoundBranchOutOfDate, uncommit.uncommit, b) b.pull(t_a.branch) uncommit.uncommit(b)
def test_post_uncommit_bound(self): master = self.make_branch('master') tree = self.make_branch_and_memory_tree('local') try: tree.branch.bind(master) except errors.UpgradeRequired: # cant bind this format, the test is irrelevant. return tree.lock_write() tree.add('') revid = tree.commit('a revision') tree.unlock() Branch.hooks.install_named_hook('post_uncommit', self.capture_post_uncommit_hook, None) uncommit(tree.branch) # with nothing left we should still get a notification, and # have the branch locked at notification time. self.assertEqual([('post_uncommit', tree.branch.base, master.base, 1, revid, 0, None, True, True)], self.hook_calls)
def test_uncommit_remove_tags_keeps_pending_merges(self): tree, history = self.make_linear_tree() copy = tree.bzrdir.sprout('copyoftree').open_workingtree() copy.commit(message='merged', rev_id='merged') tree.merge_from_branch(copy.branch) tree.branch.tags.set_tag('pointsatmerged', 'merged') history.append(tree.commit('merge')) self.assertEqual('merged', tree.branch.tags.lookup_tag('pointsatmerged')) self.assertEqual(history[2], tree.last_revision()) self.assertEqual((3, history[2]), tree.branch.last_revision_info()) tree.branch.tags.set_tag(u"pointsatexisting", history[1]) tree.branch.tags.set_tag(u"pointsatremoved", history[2]) uncommit.uncommit(tree.branch, tree=tree) self.assertEqual(history[1], tree.last_revision()) self.assertEqual((2, history[1]), tree.branch.last_revision_info()) self.assertEqual([history[1], 'merged'], tree.get_parent_ids()) self.assertEqual({ "pointsatexisting": history[1], "pointsatmerged": 'merged', }, tree.branch.tags.get_tag_dict())
def test_uncommit_remove_tags_keeps_pending_merges(self): tree, history = self.make_linear_tree() copy = tree.bzrdir.sprout('copyoftree').open_workingtree() copy.commit(message='merged', rev_id='merged') tree.merge_from_branch(copy.branch) tree.branch.tags.set_tag('pointsatmerged', 'merged') history.append(tree.commit('merge')) self.assertEquals('merged', tree.branch.tags.lookup_tag('pointsatmerged')) self.assertEqual(history[2], tree.last_revision()) self.assertEqual((3, history[2]), tree.branch.last_revision_info()) tree.branch.tags.set_tag(u"pointsatexisting", history[1]) tree.branch.tags.set_tag(u"pointsatremoved", history[2]) uncommit.uncommit(tree.branch, tree=tree) self.assertEqual(history[1], tree.last_revision()) self.assertEqual((2, history[1]), tree.branch.last_revision_info()) self.assertEquals([history[1], 'merged'], tree.get_parent_ids()) self.assertEqual({ "pointsatexisting": history[1], "pointsatmerged": 'merged', }, tree.branch.tags.get_tag_dict())
def test_post_uncommit_bound(self): master = self.make_branch('master') tree = self.make_branch_and_memory_tree('local') try: tree.branch.bind(master) except errors.UpgradeRequired: # cant bind this format, the test is irrelevant. return tree.lock_write() tree.add('') revid = tree.commit('a revision') tree.unlock() branch.Branch.hooks.install_named_hook( 'post_uncommit', self.capture_post_uncommit_hook, None) uncommit.uncommit(tree.branch) # with nothing left we should still get a notification, and # have the branch locked at notification time. self.assertEqual([ ('post_uncommit', tree.branch.base, master.base, 1, revid, 0, None, True, True) ], self.hook_calls)
def test_set_duplicate_parent_ids(self): t = self.make_branch_and_tree('.') rev1 = t.commit('first post') uncommit(t.branch, tree=t) rev2 = t.commit('second post') uncommit(t.branch, tree=t) rev3 = t.commit('third post') uncommit(t.branch, tree=t) t.set_parent_ids([rev1, rev2, rev2, rev3]) # We strip the duplicate, but preserve the ordering self.assertConsistentParents([rev1, rev2, rev3], t)
def test_set_three_parents_ids(self): t = self.make_branch_and_tree('.') first_revision = t.commit('first post') uncommit(t.branch, tree=t) second_revision = t.commit('second post') uncommit(t.branch, tree=t) third_revision = t.commit('third post') uncommit(t.branch, tree=t) rev_tree1 = t.branch.repository.revision_tree(first_revision) rev_tree2 = t.branch.repository.revision_tree(second_revision) rev_tree3 = t.branch.repository.revision_tree(third_revision) t.set_parent_ids([first_revision, second_revision, third_revision]) self.assertConsistentParents( [first_revision, second_revision, third_revision], t)
def test_set_duplicate_parent_trees(self): t = self.make_branch_and_tree('.') rev1 = t.commit('first post') uncommit(t.branch, tree=t) rev2 = t.commit('second post') uncommit(t.branch, tree=t) rev3 = t.commit('third post') uncommit(t.branch, tree=t) rev_tree1 = t.branch.repository.revision_tree(rev1) rev_tree2 = t.branch.repository.revision_tree(rev2) rev_tree3 = t.branch.repository.revision_tree(rev3) t.set_parent_trees([(rev1, rev_tree1), (rev2, rev_tree2), (rev2, rev_tree2), (rev3, rev_tree3)]) # We strip the duplicate, but preserve the ordering self.assertConsistentParents([rev1, rev2, rev3], t)
def setUp(self): self.reduceLockdirTimeout() super(TestReconcileWithIncorrectRevisionCache, self).setUp() t = get_transport(self.get_url()) # we need a revision with two parents in the wrong order # which should trigger reinsertion. # and another with the first one correct but the other two not # which should not trigger reinsertion. # these need to be in different repositories so that we don't # trigger a reconcile based on the other case. # there is no api to construct a broken knit repository at # this point. if we ever encounter a bad graph in a knit repo # we should add a lower level api to allow constructing such cases. # first off the common logic: tree = self.make_branch_and_tree('wrong-first-parent') second_tree = self.make_branch_and_tree('reversed-secondary-parents') for t in [tree, second_tree]: t.commit('1', rev_id='1') uncommit(t.branch, tree=t) t.commit('2', rev_id='2') uncommit(t.branch, tree=t) t.commit('3', rev_id='3') uncommit(t.branch, tree=t) #second_tree = self.make_branch_and_tree('reversed-secondary-parents') #second_tree.pull(tree) # XXX won't copy the repo? repo_secondary = second_tree.branch.repository # now setup the wrong-first parent case repo = tree.branch.repository repo.lock_write() repo.start_write_group() inv = Inventory(revision_id='wrong-first-parent') inv.root.revision = 'wrong-first-parent' sha1 = repo.add_inventory('wrong-first-parent', inv, ['2', '1']) rev = Revision(timestamp=0, timezone=None, committer="Foo Bar <*****@*****.**>", message="Message", inventory_sha1=sha1, revision_id='wrong-first-parent') rev.parent_ids = ['1', '2'] repo.add_revision('wrong-first-parent', rev) repo.commit_write_group() repo.unlock() # now setup the wrong-secondary parent case repo = repo_secondary repo.lock_write() repo.start_write_group() inv = Inventory(revision_id='wrong-secondary-parent') inv.root.revision = 'wrong-secondary-parent' if repo.supports_rich_root(): root_id = inv.root.file_id repo.texts.add_lines((root_id, 'wrong-secondary-parent'), [], []) sha1 = repo.add_inventory('wrong-secondary-parent', inv, ['1', '3', '2']) rev = Revision(timestamp=0, timezone=None, committer="Foo Bar <*****@*****.**>", message="Message", inventory_sha1=sha1, revision_id='wrong-secondary-parent') rev.parent_ids = ['1', '2', '3'] repo.add_revision('wrong-secondary-parent', rev) repo.commit_write_group() repo.unlock()
def uncommitRevision(self): branch = self.bzr_tree.branch uncommit(branch, tree=self.bzr_tree)