~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2011-01-10 21:31:59 UTC
  • mto: This revision was merged to the branch mainline in revision 5592.
  • Revision ID: john@arbash-meinel.com-20110110213159-lse0quagm5oyxcxu
Fix bug 701212. Don't set the tags for a master branch during update.

We currently avoid trying to write to the master branch by checking that the
source URL is the same as the master URL. Use that same logic to avoid setting
the tag dict under the same circumstances.

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())