~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2011-01-13 01:32:26 UTC
  • mfrom: (5606 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5607.
  • Revision ID: jelmer@samba.org-20110113013226-1d41bwtmps9y68wm
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 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
16
16
 
17
17
 
18
18
from bzrlib import (
 
19
    branch,
19
20
    errors,
20
21
    revision as _mod_revision,
 
22
    tests,
21
23
    )
22
24
from bzrlib.tests import per_branch
23
25
 
115
117
 
116
118
        tree1.branch.update_revisions(tree2.branch, overwrite=True)
117
119
        self.assertEqual((1, rev1), tree1.branch.last_revision_info())
 
120
 
 
121
    def test_update_in_checkout_of_readonly(self):
 
122
        tree1 = self.make_branch_and_tree('tree1')
 
123
        rev1 = tree1.commit('one')
 
124
        try:
 
125
            tree1.branch.tags.set_tag('test-tag', rev1)
 
126
        except errors.TagsNotSupported:
 
127
            # Tags not supported
 
128
            raise tests.TestNotApplicable("only triggered from branches with"
 
129
                " tags")
 
130
        readonly_branch1 = branch.Branch.open('readonly+' + tree1.branch.base)
 
131
        tree2 = tree1.bzrdir.sprout('tree2').open_workingtree()
 
132
        try:
 
133
            tree2.branch.bind(readonly_branch1)
 
134
        except errors.UpgradeRequired:
 
135
            # old branch, cant test.
 
136
            raise tests.TestNotApplicable("only triggered in bound branches")
 
137
        rev2 = tree1.commit('two')
 
138
        tree2.update()
 
139
        self.assertEqual(rev2, tree2.branch.last_revision())