~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-04-07 07:52:50 UTC
  • mfrom: (3340.1.1 208418-1.4)
  • Revision ID: pqm@pqm.ubuntu.com-20080407075250-phs53xnslo8boaeo
Return the correct knit serialisation method in _StreamAccess.
        (Andrew Bennetts, Martin Pool, Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
        """See WorkingTreeFormat.get_format_string()."""
95
95
        return "Sample tree format."
96
96
 
97
 
    def initialize(self, a_bzrdir, revision_id=None):
 
97
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
 
98
                   accelerator_tree=None, hardlink=False):
98
99
        """Sample branches cannot be created."""
99
100
        t = a_bzrdir.get_workingtree_transport(self)
100
101
        t.put_bytes('format', self.get_format_string())
309
310
        self.assertEqual(['t', 'u', 't', 'u'], tree._locks)
310
311
 
311
312
 
 
313
class TestRevert(TestCaseWithTransport):
 
314
 
 
315
    def test_revert_conflicts_recursive(self):
 
316
        this_tree = self.make_branch_and_tree('this-tree')
 
317
        self.build_tree_contents([('this-tree/foo/',),
 
318
                                  ('this-tree/foo/bar', 'bar')])
 
319
        this_tree.add(['foo', 'foo/bar'])
 
320
        this_tree.commit('created foo/bar')
 
321
        other_tree = this_tree.bzrdir.sprout('other-tree').open_workingtree()
 
322
        self.build_tree_contents([('other-tree/foo/bar', 'baz')])
 
323
        other_tree.commit('changed bar')
 
324
        self.build_tree_contents([('this-tree/foo/bar', 'qux')])
 
325
        this_tree.commit('changed qux')
 
326
        this_tree.merge_from_branch(other_tree.branch)
 
327
        self.assertEqual(1, len(this_tree.conflicts()))
 
328
        this_tree.revert(['foo'])
 
329
        self.assertEqual(0, len(this_tree.conflicts()))
 
330
 
 
331
 
312
332
class TestAutoResolve(TestCaseWithTransport):
313
333
 
314
334
    def test_auto_resolve(self):
356
376
        file_conflict = conflicts.TextConflict('file', None, 'hello-id')
357
377
        tree.set_conflicts(conflicts.ConflictList([file_conflict]))
358
378
        tree.auto_resolve()
 
379
 
 
380
 
 
381
class TestFindTrees(TestCaseWithTransport):
 
382
 
 
383
    def test_find_trees(self):
 
384
        self.make_branch_and_tree('foo')
 
385
        self.make_branch_and_tree('foo/bar')
 
386
        # Sticking a tree inside a control dir is heinous, so let's skip it
 
387
        self.make_branch_and_tree('foo/.bzr/baz')
 
388
        self.make_branch('qux')
 
389
        trees = workingtree.WorkingTree.find_trees('.')
 
390
        self.assertEqual(2, len(list(trees)))