/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 bzrlib/tests/test_revisiontree.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2008-2012, 2016 Canonical Ltd
 
1
# Copyright (C) 2006, 2008-2011 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
17
17
 
18
18
"""Tests for the RevisionTree class."""
19
19
 
20
 
from breezy import (
 
20
from bzrlib import (
21
21
    errors,
22
22
    revision,
23
23
    )
24
 
from breezy.tree import FileTimestampUnavailable
25
 
from breezy.tests import TestCaseWithTransport
 
24
from bzrlib.tests import TestCaseWithTransport
26
25
 
27
26
 
28
27
class TestTreeWithCommits(TestCaseWithTransport):
62
61
        self.assertIs(None, null_tree.get_root_id())
63
62
 
64
63
    def test_get_file_revision_root(self):
65
 
        self.assertEqual(self.rev_id,
66
 
            self.rev_tree.get_file_revision(u'', self.rev_tree.get_root_id()))
 
64
        self.assertEquals(self.rev_id,
 
65
            self.rev_tree.get_file_revision(self.rev_tree.get_root_id()))
67
66
 
68
67
    def test_get_file_revision(self):
69
 
        self.build_tree_contents([('a', b'initial')])
 
68
        self.build_tree_contents([('a', 'initial')])
70
69
        self.t.add(['a'])
71
70
        revid1 = self.t.commit('add a')
72
71
        revid2 = self.t.commit('another change', allow_pointless=True)
73
72
        tree = self.t.branch.repository.revision_tree(revid2)
74
 
        self.assertEqual(revid1,
75
 
            tree.get_file_revision('a'))
 
73
        self.assertEquals(revid1,
 
74
            tree.get_file_revision(tree.path2id('a')))
76
75
 
77
76
    def test_get_file_mtime_ghost(self):
78
 
        path = next(iter(self.rev_tree.all_versioned_paths()))
79
 
        self.rev_tree.root_inventory.get_entry(self.rev_tree.path2id(path)).revision = 'ghostrev'
80
 
        self.assertRaises(FileTimestampUnavailable, 
81
 
            self.rev_tree.get_file_mtime, path)
 
77
        file_id = iter(self.rev_tree.all_file_ids()).next()
 
78
        self.rev_tree.root_inventory[file_id].revision = 'ghostrev'
 
79
        self.assertRaises(errors.FileTimestampUnavailable, 
 
80
            self.rev_tree.get_file_mtime, file_id)