Rev 5592: (vila) Fix bug #701212, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jan 11 18:36:54 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5592 [merge]
revision-id: pqm at pqm.ubuntu.com-20110111183650-e8cxdko7r2ruh3bq
parent: pqm at pqm.ubuntu.com-20110111174511-6q6axq59ve3splyw
parent: john at arbash-meinel.com-20110110213159-lse0quagm5oyxcxu
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-01-11 18:36:50 +0000
message:
  (vila) Fix bug #701212,
   don't set the tag dict of the master branch you are updating from. (John A
   Meinel)
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/tests/per_branch/test_update.py test_update.py-20060305010612-e68efbcbb1baa69f
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2010-12-14 04:20:17 +0000
+++ b/bzrlib/branch.py	2011-01-10 21:31:59 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2010 Canonical Ltd
+# Copyright (C) 2005-2011 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -3453,7 +3453,8 @@
         if local and not bound_location:
             raise errors.LocalRequiresBoundBranch()
         master_branch = None
-        if not local and bound_location and self.source.user_url != bound_location:
+        source_is_master = (self.source.user_url == bound_location)
+        if not local and bound_location and not source_is_master:
             # not pulling from master, so we need to update master.
             master_branch = self.target.get_master_branch(possible_transports)
             master_branch.lock_write()
@@ -3465,7 +3466,8 @@
             return self._pull(overwrite,
                 stop_revision, _hook_master=master_branch,
                 run_hooks=run_hooks,
-                _override_hook_target=_override_hook_target)
+                _override_hook_target=_override_hook_target,
+                merge_tags_to_master=not source_is_master)
         finally:
             if master_branch:
                 master_branch.unlock()
@@ -3538,7 +3540,8 @@
 
     def _pull(self, overwrite=False, stop_revision=None,
              possible_transports=None, _hook_master=None, run_hooks=True,
-             _override_hook_target=None, local=False):
+             _override_hook_target=None, local=False,
+             merge_tags_to_master=True):
         """See Branch.pull.
 
         This function is the core worker, used by GenericInterBranch.pull to
@@ -3579,7 +3582,7 @@
             # so a tags implementation that versions tags can only 
             # pull in the most recent changes. -- JRV20090506
             result.tag_conflicts = self.source.tags.merge_to(self.target.tags,
-                overwrite)
+                overwrite, ignore_master=not merge_tags_to_master)
             result.new_revno, result.new_revid = self.target.last_revision_info()
             if _hook_master:
                 result.master_branch = _hook_master

=== modified file 'bzrlib/tests/per_branch/test_update.py'
--- a/bzrlib/tests/per_branch/test_update.py	2010-02-10 17:52:08 +0000
+++ b/bzrlib/tests/per_branch/test_update.py	2011-01-10 21:31:59 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2010 Canonical Ltd
+# Copyright (C) 2006-2011 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -16,8 +16,10 @@
 
 
 from bzrlib import (
+    branch,
     errors,
     revision as _mod_revision,
+    tests,
     )
 from bzrlib.tests import per_branch
 
@@ -115,3 +117,23 @@
 
         tree1.branch.update_revisions(tree2.branch, overwrite=True)
         self.assertEqual((1, rev1), tree1.branch.last_revision_info())
+
+    def test_update_in_checkout_of_readonly(self):
+        tree1 = self.make_branch_and_tree('tree1')
+        rev1 = tree1.commit('one')
+        try:
+            tree1.branch.tags.set_tag('test-tag', rev1)
+        except errors.TagsNotSupported:
+            # Tags not supported
+            raise tests.TestNotApplicable("only triggered from branches with"
+                " tags")
+        readonly_branch1 = branch.Branch.open('readonly+' + tree1.branch.base)
+        tree2 = tree1.bzrdir.sprout('tree2').open_workingtree()
+        try:
+            tree2.branch.bind(readonly_branch1)
+        except errors.UpgradeRequired:
+            # old branch, cant test.
+            raise tests.TestNotApplicable("only triggered in bound branches")
+        rev2 = tree1.commit('two')
+        tree2.update()
+        self.assertEqual(rev2, tree2.branch.last_revision())

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2011-01-11 05:54:26 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2011-01-11 18:36:50 +0000
@@ -59,6 +59,10 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* ``bzr update`` in a checkout of a readonly branch works again, without
+  trying to set the tags in the master branch. This had been broken by the
+  bug fix for bug #603395.  (John Arbash Meinel, #701212)
+
 Documentation
 *************
 




More information about the bazaar-commits mailing list