~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository/test_reconcile.py

Merge up through 2.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
 
19
19
 
20
20
import bzrlib
21
 
import bzrlib.errors as errors
 
21
from bzrlib import (
 
22
    errors,
 
23
    transport,
 
24
    )
22
25
from bzrlib.inventory import Inventory
23
26
from bzrlib.reconcile import reconcile, Reconciler
24
27
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit
30
33
from bzrlib.tests.per_repository import (
31
34
    TestCaseWithRepository,
32
35
    )
33
 
from bzrlib.transport import get_transport
34
36
from bzrlib.uncommit import uncommit
35
37
 
36
38
 
59
61
    def setUp(self):
60
62
        super(TestsNeedingReweave, self).setUp()
61
63
 
62
 
        t = get_transport(self.get_url())
 
64
        t = transport.get_transport(self.get_url())
63
65
        # an empty inventory with no revision for testing with.
64
66
        repo = self.make_repository('inventory_without_revision')
65
67
        repo.lock_write()
310
312
        self.reduceLockdirTimeout()
311
313
        super(TestReconcileWithIncorrectRevisionCache, self).setUp()
312
314
 
313
 
        t = get_transport(self.get_url())
 
315
        t = transport.get_transport(self.get_url())
314
316
        # we need a revision with two parents in the wrong order
315
317
        # which should trigger reinsertion.
316
318
        # and another with the first one correct but the other two not
341
343
        repo.start_write_group()
342
344
        inv = Inventory(revision_id='wrong-first-parent')
343
345
        inv.root.revision = 'wrong-first-parent'
 
346
        if repo.supports_rich_root():
 
347
            root_id = inv.root.file_id
 
348
            repo.texts.add_lines((root_id, 'wrong-first-parent'), [], [])
344
349
        sha1 = repo.add_inventory('wrong-first-parent', inv, ['2', '1'])
345
350
        rev = Revision(timestamp=0,
346
351
                       timezone=None,
376
381
 
377
382
    def test_reconcile_wrong_order(self):
378
383
        # a wrong order in primary parents is optionally correctable
379
 
        t = get_transport(self.get_url()).clone('wrong-first-parent')
 
384
        t = transport.get_transport(self.get_url()).clone('wrong-first-parent')
380
385
        d = bzrlib.bzrdir.BzrDir.open_from_transport(t)
381
386
        repo = d.open_repository()
382
387
        repo.lock_read()
405
410
 
406
411
    def test_reconcile_wrong_order_secondary_inventory(self):
407
412
        # a wrong order in the parents for inventories is ignored.
408
 
        t = get_transport(self.get_url()).clone('reversed-secondary-parents')
 
413
        t = transport.get_transport(self.get_url()
 
414
                                    ).clone('reversed-secondary-parents')
409
415
        d = bzrlib.bzrdir.BzrDir.open_from_transport(t)
410
416
        repo = d.open_repository()
411
417
        self.checkUnreconciled(d, repo.reconcile())