~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revision.py

  • Committer: Martin Pool
  • Date: 2010-02-25 06:17:27 UTC
  • mfrom: (5055 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5057.
  • Revision ID: mbp@sourcefrog.net-20100225061727-4sd9lt0qmdc6087t
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005 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
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
 
18
import os
18
19
import warnings
19
20
 
20
21
from bzrlib import (
21
22
    bugtracker,
22
23
    revision,
 
24
    symbol_versioning,
23
25
    )
 
26
from bzrlib.branch import Branch
24
27
from bzrlib.errors import (
25
28
    InvalidBugStatus,
26
29
    InvalidLineInBugsProperty,
 
30
    NoSuchRevision,
27
31
    )
28
 
from bzrlib.revision import NULL_REVISION
 
32
from bzrlib.deprecated_graph import Graph
 
33
from bzrlib.revision import (find_present_ancestors,
 
34
                             NULL_REVISION)
29
35
from bzrlib.tests import TestCase, TestCaseWithTransport
30
 
from bzrlib.tests.matchers import MatchesAncestry
 
36
from bzrlib.trace import mutter
 
37
from bzrlib.workingtree import WorkingTree
31
38
 
32
39
# We're allowed to test deprecated interfaces
33
40
warnings.filterwarnings('ignore',
104
111
             ('a@u-0-5', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2', 'a@u-0-3', 'a@u-0-4',
105
112
                          'b@u-0-3', 'b@u-0-4',
106
113
                          'b@u-0-5', 'a@u-0-5']),
107
 
             ('b@u-0-6', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2', 'a@u-0-4',
 
114
             ('b@u-0-6', ['a@u-0-0', 'a@u-0-1', 'a@u-0-2',
108
115
                          'b@u-0-3', 'b@u-0-4',
109
116
                          'b@u-0-5', 'b@u-0-6']),
110
117
             ]
116
123
                    continue
117
124
                if rev_id in br2_only and not branch is br2:
118
125
                    continue
119
 
                self.assertThat(anc,
120
 
                    MatchesAncestry(branch.repository, rev_id))
 
126
                mutter('ancestry of {%s}: %r',
 
127
                       rev_id, branch.repository.get_ancestry(rev_id))
 
128
                result = sorted(branch.repository.get_ancestry(rev_id))
 
129
                self.assertEquals(result, [None] + sorted(anc))
121
130
 
122
131
 
123
132
class TestIntermediateRevisions(TestCaseWithTransport):
202
211
        r.message = None
203
212
        self.assertEqual('', r.get_summary())
204
213
 
 
214
    def test_get_apparent_author(self):
 
215
        r = revision.Revision('1')
 
216
        r.committer = 'A'
 
217
        author = self.applyDeprecated(
 
218
                symbol_versioning.deprecated_in((1, 13, 0)),
 
219
                r.get_apparent_author)
 
220
        self.assertEqual('A', author)
 
221
        r.properties['author'] = 'B'
 
222
        author = self.applyDeprecated(
 
223
                symbol_versioning.deprecated_in((1, 13, 0)),
 
224
                r.get_apparent_author)
 
225
        self.assertEqual('B', author)
 
226
        r.properties['authors'] = 'C\nD'
 
227
        author = self.applyDeprecated(
 
228
                symbol_versioning.deprecated_in((1, 13, 0)),
 
229
                r.get_apparent_author)
 
230
        self.assertEqual('C', author)
 
231
 
 
232
    def test_get_apparent_author_none(self):
 
233
        r = revision.Revision('1')
 
234
        author = self.applyDeprecated(
 
235
                symbol_versioning.deprecated_in((1, 13, 0)),
 
236
                r.get_apparent_author)
 
237
        self.assertEqual(None, author)
 
238
 
205
239
    def test_get_apparent_authors(self):
206
240
        r = revision.Revision('1')
207
241
        r.committer = 'A'