~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: Vincent Ladeuil
  • Date: 2017-01-17 13:48:10 UTC
  • mfrom: (6615.3.6 merges)
  • mto: This revision was merged to the branch mainline in revision 6620.
  • Revision ID: v.ladeuil+lp@free.fr-20170117134810-j9p3lidfy6pfyfsc
Merge 2.7, resolving conflicts

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
40
40
        tree1.commit('1st post')
41
41
        revid = tree1.commit('2st post', allow_pointless=True)
42
42
        branch2 = self.make_branch('branch2')
43
 
        branch2.import_last_revision_info(tree1.branch.repository, 2, revid)
 
43
        self.assertEqual((2, revid),
 
44
            branch2.import_last_revision_info_and_tags(tree1.branch, 2, revid))
44
45
        self.assertEqual((2, revid), branch2.last_revision_info())
45
46
        self.assertTrue(branch2.repository.has_revision(revid))
46
47
 
 
48
    def test_import_lossy(self):
 
49
        # importing with lossy=True works
 
50
        tree1 = self.make_branch_and_tree('branch1')
 
51
        tree1.commit('1st post')
 
52
        revid = tree1.commit('2st post', allow_pointless=True)
 
53
        branch2 = self.make_branch('branch2')
 
54
        ret = branch2.import_last_revision_info_and_tags(tree1.branch, 2,
 
55
            revid, lossy=True)
 
56
        self.assertIsInstance(ret, tuple)
 
57
        self.assertIsInstance(ret[0], int)
 
58
        self.assertIsInstance(ret[1], str)
 
59
 
47
60
    def test_same_repo(self):
48
61
        # importing and setting last revision within the same repo
49
62
        tree = self.make_branch_and_tree('branch1')
50
63
        tree.commit('1st post')
51
64
        revid = tree.commit('2st post', allow_pointless=True)
52
65
        tree.branch.set_last_revision_info(0, NULL_REVISION)
53
 
        tree.branch.import_last_revision_info(tree.branch.repository, 2, revid)
 
66
        tree.branch.import_last_revision_info_and_tags(tree.branch, 2, revid)
54
67
        self.assertEqual((2, revid), tree.branch.last_revision_info())