~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revision.py

(vila) Open 2.4.3 for bug fixes (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 
 
17
 
 
18
 
import os
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
 
 
17
 
19
18
import warnings
20
19
 
21
20
from bzrlib import (
22
21
    bugtracker,
23
22
    revision,
24
 
    symbol_versioning,
25
23
    )
26
 
from bzrlib.branch import Branch
27
24
from bzrlib.errors import (
28
25
    InvalidBugStatus,
29
26
    InvalidLineInBugsProperty,
30
 
    NoSuchRevision,
31
27
    )
32
 
from bzrlib.deprecated_graph import Graph
33
 
from bzrlib.revision import (find_present_ancestors,
34
 
                             NULL_REVISION)
35
 
from bzrlib.symbol_versioning import one_three
 
28
from bzrlib.revision import NULL_REVISION
36
29
from bzrlib.tests import TestCase, TestCaseWithTransport
37
 
from bzrlib.trace import mutter
38
 
from bzrlib.workingtree import WorkingTree
 
30
from bzrlib.tests.matchers import MatchesAncestry
39
31
 
40
32
# We're allowed to test deprecated interfaces
41
33
warnings.filterwarnings('ignore',
112
104
             ('a@u-0-5', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2', 'a@u-0-3', 'a@u-0-4',
113
105
                          'b@u-0-3', 'b@u-0-4',
114
106
                          'b@u-0-5', 'a@u-0-5']),
115
 
             ('b@u-0-6', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2',
 
107
             ('b@u-0-6', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2', 'a@u-0-4',
116
108
                          'b@u-0-3', 'b@u-0-4',
117
109
                          'b@u-0-5', 'b@u-0-6']),
118
110
             ]
124
116
                    continue
125
117
                if rev_id in br2_only and not branch is br2:
126
118
                    continue
127
 
                mutter('ancestry of {%s}: %r',
128
 
                       rev_id, branch.repository.get_ancestry(rev_id))
129
 
                result = sorted(branch.repository.get_ancestry(rev_id))
130
 
                self.assertEquals(result, [None] + sorted(anc))
 
119
                self.assertThat(anc,
 
120
                    MatchesAncestry(branch.repository, rev_id))
131
121
 
132
122
 
133
123
class TestIntermediateRevisions(TestCaseWithTransport):
209
199
        self.assertEqual('a', r.get_summary())
210
200
        r.message = '\na\nb'
211
201
        self.assertEqual('a', r.get_summary())
212
 
 
213
 
    def test_get_apparent_author(self):
214
 
        r = revision.Revision('1')
215
 
        r.committer = 'A'
216
 
        author = self.applyDeprecated(
217
 
                symbol_versioning.deprecated_in((1, 13, 0)),
218
 
                r.get_apparent_author)
219
 
        self.assertEqual('A', author)
220
 
        r.properties['author'] = 'B'
221
 
        author = self.applyDeprecated(
222
 
                symbol_versioning.deprecated_in((1, 13, 0)),
223
 
                r.get_apparent_author)
224
 
        self.assertEqual('B', author)
225
 
        r.properties['authors'] = 'C\nD'
226
 
        author = self.applyDeprecated(
227
 
                symbol_versioning.deprecated_in((1, 13, 0)),
228
 
                r.get_apparent_author)
229
 
        self.assertEqual('C', author)
 
202
        r.message = None
 
203
        self.assertEqual('', r.get_summary())
230
204
 
231
205
    def test_get_apparent_authors(self):
232
206
        r = revision.Revision('1')
237
211
        r.properties['authors'] = 'C\nD'
238
212
        self.assertEqual(['C', 'D'], r.get_apparent_authors())
239
213
 
 
214
    def test_get_apparent_authors_no_committer(self):
 
215
        r = revision.Revision('1')
 
216
        self.assertEqual([], r.get_apparent_authors())
 
217
 
240
218
 
241
219
class TestRevisionBugs(TestCase):
242
220
    """Tests for getting the bugs that a revision is linked to."""