517
518
tree.branch.nick = 'foo'
518
519
tree.branch.record_loom('foo')
519
520
self.assertEqual([], tree.branch.get_threads(NULL_REVISION))
522
def get_multi_threaded(self):
523
tree = self.get_tree_with_loom()
524
tree.branch.new_thread('thread1')
525
tree.branch.nick = 'thread1'
526
tree.commit('thread1', rev_id='thread1-id')
527
tree.branch.new_thread('thread2', 'thread1')
528
tree.branch.nick = 'thread2'
529
tree.commit('thread2', rev_id='thread2-id')
532
def test_export_loom_initial(self):
533
tree = self.get_multi_threaded()
534
root_transport = tree.branch.bzrdir.root_transport
535
tree.branch.export_threads(root_transport)
536
thread1 = Branch.open_from_transport(root_transport.clone('thread1'))
537
self.assertEqual('thread1-id', thread1.last_revision())
538
thread2 = Branch.open_from_transport(root_transport.clone('thread2'))
539
self.assertEqual('thread2-id', thread2.last_revision())
541
def test_export_loom_update(self):
542
tree = self.get_multi_threaded()
543
root_transport = tree.branch.bzrdir.root_transport
544
tree.branch.export_threads(root_transport)
545
tree.commit('thread2-2', rev_id='thread2-2-id')
546
tree.branch.export_threads(root_transport)
547
thread1 = Branch.open_from_transport(root_transport.clone('thread1'))
548
self.assertEqual('thread1-id', thread1.last_revision())
549
thread2 = Branch.open_from_transport(root_transport.clone('thread2'))
550
self.assertEqual('thread2-2-id', thread2.last_revision())
552
def test_export_loom_root_transport(self):
553
tree = self.get_multi_threaded()
554
tree.branch.bzrdir.root_transport.mkdir('root')
555
root_transport = tree.branch.bzrdir.root_transport.clone('root')
556
tree.branch.export_threads(root_transport)
557
thread1 = Branch.open_from_transport(root_transport.clone('thread1'))
558
thread1 = Branch.open_from_transport(root_transport.clone('thread1'))
559
self.assertEqual('thread1-id', thread1.last_revision())
560
thread2 = Branch.open_from_transport(root_transport.clone('thread2'))
561
self.assertEqual('thread2-id', thread2.last_revision())