~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_last_revision_info.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2007 Canonical Ltd
 
1
# Copyright (C) 2007, 2009-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
17
17
"""Tests for branch.last_revision_info."""
18
18
 
19
19
from bzrlib.revision import NULL_REVISION
20
 
from bzrlib.symbol_versioning import deprecated_in
21
20
from bzrlib.tests import TestCaseWithTransport
22
21
 
23
22
 
35
34
        revid = tree.commit('2st post', allow_pointless=True)
36
35
        self.assertEqual((2, revid), tree.branch.last_revision_info())
37
36
 
38
 
    def test_import_deprecated(self):
39
 
        # importing and setting last revision
40
 
        tree1 = self.make_branch_and_tree('branch1')
41
 
        tree1.commit('1st post')
42
 
        revid = tree1.commit('2st post', allow_pointless=True)
43
 
        branch2 = self.make_branch('branch2')
44
 
        self.applyDeprecated(deprecated_in((2, 4, 0)),
45
 
            branch2.import_last_revision_info, tree1.branch.repository, 2, revid)
46
 
        self.assertEqual((2, revid), branch2.last_revision_info())
47
 
        self.assertTrue(branch2.repository.has_revision(revid))
48
 
 
49
 
    def test_same_repo_deprecated(self):
50
 
        # importing and setting last revision within the same repo
51
 
        tree = self.make_branch_and_tree('branch1')
52
 
        tree.commit('1st post')
53
 
        revid = tree.commit('2st post', allow_pointless=True)
54
 
        tree.branch.set_last_revision_info(0, NULL_REVISION)
55
 
        self.applyDeprecated(deprecated_in((2, 4, 0)),
56
 
            tree.branch.import_last_revision_info, tree.branch.repository, 2, revid)
57
 
        self.assertEqual((2, revid), tree.branch.last_revision_info())
58
 
 
59
37
    def test_import(self):
60
38
        # importing and setting last revision
61
39
        tree1 = self.make_branch_and_tree('branch1')
62
40
        tree1.commit('1st post')
63
41
        revid = tree1.commit('2st post', allow_pointless=True)
64
42
        branch2 = self.make_branch('branch2')
65
 
        self.assertEquals((2, revid),
 
43
        self.assertEqual((2, revid),
66
44
            branch2.import_last_revision_info_and_tags(tree1.branch, 2, revid))
67
45
        self.assertEqual((2, revid), branch2.last_revision_info())
68
46
        self.assertTrue(branch2.repository.has_revision(revid))