~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revisionspec.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2012, 2016 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
20
20
from bzrlib import (
21
21
    errors,
22
22
    revision as _mod_revision,
 
23
    symbol_versioning,
23
24
    )
24
25
from bzrlib.tests import TestCaseWithTransport
25
26
from bzrlib.revisionspec import (
118
119
        # If wants_revision_history = True, then _match_on should get the
119
120
        # branch revision history
120
121
        spec = RevisionSpecMatchOnTrap('foo', _internal=True)
121
 
        spec.in_history(self.tree.branch)
 
122
        spec.wants_revision_history = True
 
123
        self.callDeprecated(['RevisionSpec.wants_revision_history was '
 
124
            'deprecated in 2.5 (RevisionSpecMatchOnTrap).'],
 
125
            spec.in_history, self.tree.branch)
122
126
 
123
127
        self.assertEqual((self.tree.branch, ['r1' ,'r2']),
124
128
                         spec.last_call)
127
131
        # If wants_revision_history = False, then _match_on should get None for
128
132
        # the branch revision history
129
133
        spec = RevisionSpecMatchOnTrap('foo', _internal=True)
130
 
        spec.wants_revision_history = False
131
134
        spec.in_history(self.tree.branch)
132
135
 
133
136
        self.assertEqual((self.tree.branch, None), spec.last_call)
150
153
 
151
154
    def _match_on(self, branch, revs):
152
155
        if self.spec == "bork":
153
 
            return RevisionInfo.from_revision_id(branch, "r1", revs)
 
156
            return RevisionInfo.from_revision_id(branch, "r1")
154
157
        else:
155
158
            raise errors.InvalidRevisionSpec(self.spec, branch)
156
159
 
360
363
 
361
364
    def test_as_tree(self):
362
365
        tree = self.get_as_tree('0')
363
 
        self.assertEquals(_mod_revision.NULL_REVISION, tree.get_revision_id())
 
366
        self.assertEqual(_mod_revision.NULL_REVISION, tree.get_revision_id())
364
367
        tree = self.get_as_tree('1')
365
 
        self.assertEquals('r1', tree.get_revision_id())
 
368
        self.assertEqual('r1', tree.get_revision_id())
366
369
        tree = self.get_as_tree('2')
367
 
        self.assertEquals('r2', tree.get_revision_id())
 
370
        self.assertEqual('r2', tree.get_revision_id())
368
371
        tree = self.get_as_tree('-2')
369
 
        self.assertEquals('r1', tree.get_revision_id())
 
372
        self.assertEqual('r1', tree.get_revision_id())
370
373
        tree = self.get_as_tree('-1')
371
 
        self.assertEquals('r2', tree.get_revision_id())
 
374
        self.assertEqual('r2', tree.get_revision_id())
372
375
        tree = self.get_as_tree('1.1.1')
373
 
        self.assertEquals('alt_r2', tree.get_revision_id())
 
376
        self.assertEqual('alt_r2', tree.get_revision_id())
374
377
 
375
378
 
376
379
class TestRevisionSpec_revid(TestRevisionSpec):
653
656
 
654
657
    def test_as_tree(self):
655
658
        tree = self.get_as_tree('branch:tree', self.tree2)
656
 
        self.assertEquals('r2', tree.get_revision_id())
 
659
        self.assertEqual('r2', tree.get_revision_id())
657
660
        self.assertFalse(self.tree2.branch.repository.has_revision('r2'))
658
661
 
659
662
 
697
700
class TestRevisionSpec_annotate(TestRevisionSpec):
698
701
 
699
702
    def setUp(self):
700
 
        TestRevisionSpec.setUp(self)
 
703
        super(TestRevisionSpec_annotate, self).setUp()
701
704
        self.tree = self.make_branch_and_tree('annotate-tree')
702
705
        self.build_tree_contents([('annotate-tree/file1', '1\n')])
703
706
        self.tree.add('file1')