/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Tests for branch.last_revision_info."""
18
18
 
26
26
        # on an empty branch we want (0, NULL_REVISION)
27
27
        branch = self.make_branch('branch')
28
28
        self.assertEqual((0, NULL_REVISION), branch.last_revision_info())
29
 
    
 
29
 
30
30
    def test_non_empty_branch(self):
31
31
        # after the second commit we want (2, 'second-revid')
32
32
        tree = self.make_branch_and_tree('branch')
33
33
        tree.commit('1st post')
34
34
        revid = tree.commit('2st post', allow_pointless=True)
35
35
        self.assertEqual((2, revid), tree.branch.last_revision_info())
 
36
 
 
37
    def test_import(self):
 
38
        # importing and setting last revision
 
39
        tree1 = self.make_branch_and_tree('branch1')
 
40
        tree1.commit('1st post')
 
41
        revid = tree1.commit('2st post', allow_pointless=True)
 
42
        branch2 = self.make_branch('branch2')
 
43
        branch2.import_last_revision_info(tree1.branch.repository, 2, revid)
 
44
        self.assertEqual((2, revid), branch2.last_revision_info())
 
45
        self.assertTrue(branch2.repository.has_revision(revid))
 
46
 
 
47
    def test_same_repo(self):
 
48
        # importing and setting last revision within the same repo
 
49
        tree = self.make_branch_and_tree('branch1')
 
50
        tree.commit('1st post')
 
51
        revid = tree.commit('2st post', allow_pointless=True)
 
52
        tree.branch.set_last_revision_info(0, NULL_REVISION)
 
53
        tree.branch.import_last_revision_info(tree.branch.repository, 2, revid)
 
54
        self.assertEqual((2, revid), tree.branch.last_revision_info())