/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/per_workingtree/test_locking.py

  • Committer: Jelmer Vernooij
  • Date: 2019-09-21 17:08:09 UTC
  • mfrom: (7389 work)
  • mto: This revision was merged to the branch mainline in revision 7390.
  • Revision ID: jelmer@jelmer.uk-20190921170809-ejewbeue585deajo
merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        # e.g. mkdir('foo') but all the mutating methods at the
149
149
        # moment trigger inventory writes and thus will not
150
150
        # let us trigger a read-when-dirty situation.
151
 
        old_root = tree.get_root_id()
 
151
        old_root = tree.path2id('')
152
152
        tree.add('')
153
153
        # to detect that the inventory is written by unlock, we
154
154
        # first check that it was not written yet.
155
155
        # TODO: This requires taking a read lock while we are holding the above
156
156
        #       write lock, which shouldn't actually be possible
157
157
        reference_tree = tree.controldir.open_workingtree()
158
 
        self.assertEqual(old_root, reference_tree.get_root_id())
 
158
        self.assertEqual(old_root, reference_tree.path2id(''))
159
159
        # now unlock the second held lock, which should do nothing.
160
160
        tree.unlock()
161
161
        reference_tree = tree.controldir.open_workingtree()
162
 
        self.assertEqual(old_root, reference_tree.get_root_id())
 
162
        self.assertEqual(old_root, reference_tree.path2id(''))
163
163
        # unlocking the first lock we took will now flush.
164
164
        tree.unlock()
165
165
        # and check it was written using another reference tree
166
166
        reference_tree = tree.controldir.open_workingtree()
167
 
        self.assertIsNot(None, reference_tree.get_root_id())
 
167
        self.assertIsNot(None, reference_tree.path2id(''))
168
168
 
169
169
    def test_unlock_from_tree_write_lock_flushes(self):
170
170
        self._test_unlock_with_lock_method("lock_tree_write")