/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_revision.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) 2005-2011, 2016 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
17
17
 
18
18
import warnings
19
19
 
20
 
from breezy import (
 
20
from bzrlib import (
21
21
    bugtracker,
22
22
    revision,
23
23
    )
24
 
from breezy.revision import NULL_REVISION
25
 
from breezy.tests import TestCase, TestCaseWithTransport
26
 
from breezy.tests.matchers import MatchesAncestry
 
24
from bzrlib.errors import (
 
25
    InvalidBugStatus,
 
26
    InvalidLineInBugsProperty,
 
27
    )
 
28
from bzrlib.revision import NULL_REVISION
 
29
from bzrlib.tests import TestCase, TestCaseWithTransport
 
30
from bzrlib.tests.matchers import MatchesAncestry
27
31
 
28
32
# We're allowed to test deprecated interfaces
29
33
warnings.filterwarnings('ignore',
30
34
        '.*get_intervening_revisions was deprecated',
31
35
        DeprecationWarning,
32
 
        r'breezy\.tests\.test_revision')
 
36
        r'bzrlib\.tests\.test_revision')
33
37
 
34
38
# XXX: Make this a method of a merge base case
35
39
def make_branches(self, format=None):
58
62
    tree1.commit("Commit two", rev_id="a@u-0-1")
59
63
    tree1.commit("Commit three", rev_id="a@u-0-2")
60
64
 
61
 
    tree2 = tree1.controldir.sprout("branch2").open_workingtree()
 
65
    tree2 = tree1.bzrdir.sprout("branch2").open_workingtree()
62
66
    br2 = tree2.branch
63
67
    tree2.commit("Commit four", rev_id="b@u-0-3")
64
68
    tree2.commit("Commit five", rev_id="b@u-0-4")
65
 
    self.assertEqual(br2.last_revision(), 'b@u-0-4')
 
69
    self.assertEquals(br2.last_revision(), 'b@u-0-4')
66
70
 
67
71
    tree1.merge_from_branch(br2)
68
72
    tree1.commit("Commit six", rev_id="a@u-0-3")
69
73
    tree1.commit("Commit seven", rev_id="a@u-0-4")
70
74
    tree2.commit("Commit eight", rev_id="b@u-0-5")
71
 
    self.assertEqual(br2.last_revision(), 'b@u-0-5')
 
75
    self.assertEquals(br2.last_revision(), 'b@u-0-5')
72
76
 
73
77
    tree1.merge_from_branch(br2)
74
78
    tree1.commit("Commit nine", rev_id="a@u-0-5")
128
132
    def setUp(self):
129
133
        TestCaseWithTransport.setUp(self)
130
134
        self.br1, self.br2 = make_branches(self)
131
 
        wt1 = self.br1.controldir.open_workingtree()
132
 
        wt2 = self.br2.controldir.open_workingtree()
 
135
        wt1 = self.br1.bzrdir.open_workingtree()
 
136
        wt2 = self.br2.bzrdir.open_workingtree()
133
137
        wt2.commit("Commit eleven", rev_id="b@u-0-7")
134
138
        wt2.commit("Commit twelve", rev_id="b@u-0-8")
135
139
        wt2.commit("Commit thirtteen", rev_id="b@u-0-9")
176
180
        self.assertEqual([None, '1', '2'], history)
177
181
        rev = tree.branch.repository.get_revision('3')
178
182
        history = rev.get_history(tree.branch.repository)
179
 
        self.assertEqual([None, '1', '2', '3'], history)
 
183
        self.assertEqual([None, '1', '2' ,'3'], history)
180
184
 
181
185
 
182
186
class TestReservedId(TestCase):
240
244
    def test_no_status(self):
241
245
        r = revision.Revision(
242
246
            '1', properties={'bugs': 'http://example.com/bugs/1'})
243
 
        self.assertRaises(bugtracker.InvalidLineInBugsProperty, list,
244
 
                r.iter_bugs())
 
247
        self.assertRaises(InvalidLineInBugsProperty, list, r.iter_bugs())
245
248
 
246
249
    def test_too_much_information(self):
247
250
        r = revision.Revision(
248
251
            '1', properties={'bugs': 'http://example.com/bugs/1 fixed bar'})
249
 
        self.assertRaises(bugtracker.InvalidLineInBugsProperty, list,
250
 
                r.iter_bugs())
 
252
        self.assertRaises(InvalidLineInBugsProperty, list, r.iter_bugs())
251
253
 
252
254
    def test_invalid_status(self):
253
255
        r = revision.Revision(
254
256
            '1', properties={'bugs': 'http://example.com/bugs/1 faxed'})
255
 
        self.assertRaises(bugtracker.InvalidBugStatus, list, r.iter_bugs())
 
257
        self.assertRaises(InvalidBugStatus, list, r.iter_bugs())