~ubuntu-branches/ubuntu/maverick/bzr/maverick

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree_4.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-08-07 00:54:52 UTC
  • mfrom: (1.4.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100807005452-g4zb99ezl3xn44r4
Tags: 2.2.0-1
* New upstream release.
 + Adds support for setting timestamps to originating revisions.
   Closes: #473450
 + Removes remaining string exception. Closes: #585193, LP: #586926
 + Add C extension to work around Python issue 1628205. LP: #583941,
   Closes: #577110
 + Avoids showing progress bars when --quiet is used. Closes: #542105,
   LP: #320035
 + No longer creates ~/.bazaar as root when run under sudo. LP: #376388
 + 'bzr commit' now supports -p as alternative for --show-diff. LP: #571467
 + 'bzr add' no longer adds .THIS/.BASE/.THEIRS files unless
   explicitly requested. LP: #322767
 + When parsing patch files, Bazaar now supports diff lines before each
   patch. LP: #502076
 + WorkingTrees now no longer requires using signal.signal, so can
   be used in a threaded environment. LP: #521989
 + An assertion error is no longer triggered when pushing to a pre-1.6
   Bazaar server. LP: #528041
* Bump standards version to 3.9.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
# Authors:  Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
176
176
        repo = tree.branch.repository
177
177
        repo.get_revision = self.fail
178
178
        repo.get_inventory = self.fail
179
 
        repo.get_inventory_xml = self.fail
 
179
        repo._get_inventory_xml = self.fail
180
180
        # try to set the parent trees.
181
181
        tree.set_parent_trees([(rev1, rev1_tree)])
182
182
 
215
215
        # cache the parents of a parent tree at this point.
216
216
        #repo.get_revision = self.fail
217
217
        repo.get_inventory = self.fail
218
 
        repo.get_inventory_xml = self.fail
 
218
        repo._get_inventory_xml = self.fail
219
219
        # set the parent trees.
220
220
        tree.set_parent_trees([(rev1, rev1_tree), (rev2, rev2_tree)])
221
221
        # read the first tree
555
555
        tree.commit('one', rev_id='rev-1')
556
556
        # Trap osutils._walkdirs_utf8 to spy on what dirs have been accessed.
557
557
        returned = []
558
 
        orig_walkdirs = osutils._walkdirs_utf8
559
 
        def reset():
560
 
            osutils._walkdirs_utf8 = orig_walkdirs
561
 
        self.addCleanup(reset)
562
558
        def walkdirs_spy(*args, **kwargs):
563
 
            for val in orig_walkdirs(*args, **kwargs):
 
559
            for val in orig(*args, **kwargs):
564
560
                returned.append(val[0][0])
565
561
                yield val
566
 
        osutils._walkdirs_utf8 = walkdirs_spy
 
562
        orig = self.overrideAttr(osutils, '_walkdirs_utf8', walkdirs_spy)
567
563
 
568
564
        basis = tree.basis_tree()
569
565
        tree.lock_read()
761
757
            ('', [(('', 'dir', 'dir-id'), ['d', 'd'])]),
762
758
            ('dir', [(('dir', 'file', 'file-id'), ['a', 'f'])]),
763
759
        ],  self.get_simple_dirblocks(state))
 
760
 
 
761
 
 
762
class TestInventoryCoherency(TestCaseWithTransport):
 
763
 
 
764
    def test_inventory_is_synced_when_unversioning_a_dir(self):
 
765
        """Unversioning the root of a subtree unversions the entire subtree."""
 
766
        tree = self.make_branch_and_tree('.')
 
767
        self.build_tree(['a/', 'a/b', 'c/'])
 
768
        tree.add(['a', 'a/b', 'c'], ['a-id', 'b-id', 'c-id'])
 
769
        # within a lock unversion should take effect
 
770
        tree.lock_write()
 
771
        self.addCleanup(tree.unlock)
 
772
        # Force access to the in memory inventory to trigger bug #494221: try
 
773
        # maintaining the in-memory inventory
 
774
        inv = tree.inventory
 
775
        self.assertTrue(inv.has_id('a-id'))
 
776
        self.assertTrue(inv.has_id('b-id'))
 
777
        tree.unversion(['a-id', 'b-id'])
 
778
        self.assertFalse(inv.has_id('a-id'))
 
779
        self.assertFalse(inv.has_id('b-id'))