23
from bzrlib.errors import KnitError, RevisionAlreadyPresent
23
from bzrlib.errors import KnitError, RevisionAlreadyPresent, NoSuchFile
24
24
from bzrlib.knit import (
358
358
"revid fulltext 0 84 .a_ghost :",
361
def test_create_parent_dir(self):
362
"""create_parent_dir can create knits in nonexistant dirs"""
363
# Has no effect if we don't set 'delay_create'
364
trans = get_transport('.')
365
self.assertRaises(NoSuchFile, KnitVersionedFile, 'dir/test',
366
trans, access_mode='w', factory=None,
367
create=True, create_parent_dir=True)
368
# Nothing should have changed yet
369
knit = KnitVersionedFile('dir/test', trans, access_mode='w',
370
factory=None, create=True,
371
create_parent_dir=True,
373
self.failIfExists('dir/test.knit')
374
self.failIfExists('dir/test.kndx')
375
self.failIfExists('dir')
376
knit.add_lines('revid', [], ['a\n'])
377
self.failUnlessExists('dir')
378
self.failUnlessExists('dir/test.knit')
379
self.assertFileEqual(
380
"# bzr knit index 8\n"
382
"revid fulltext 0 84 :",
361
385
def test_plan_merge(self):
362
386
my_knit = self.make_test_knit(annotate=True)
363
387
my_knit.add_lines('text1', [], split_lines(TEXT_1))