Rev 6029: (jameinel) Bug #771184, in file:///home/pqm/archives/thelove/bzr/2.4/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Aug 10 17:01:58 UTC 2011


At file:///home/pqm/archives/thelove/bzr/2.4/

------------------------------------------------------------
revno: 6029 [merge]
revision-id: pqm at pqm.ubuntu.com-20110810170153-hs7vuauw37vqi8qu
parent: pqm at pqm.ubuntu.com-20110810093809-perfac4es3i9goy3
parent: john at arbash-meinel.com-20110810140204-3ppg9vbeikxq5lmd
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.4
timestamp: Wed 2011-08-10 17:01:53 +0000
message:
  (jameinel) Bug #771184,
   add a config entry: 'branch.fetch_tags' defaulting it to False (John A
   Meinel)
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
  bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
  bzrlib/tests/blackbox/test_pull.py test_pull.py-20051201144907-64959364f629947f
  bzrlib/tests/per_branch/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
  bzrlib/tests/per_controldir/test_controldir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
  bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
  bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
  doc/en/whats-new/whats-new-in-2.4.txt whatsnewin2.4.txt-20110114044330-nipk1og7j729fy89-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2011-07-18 14:43:35 +0000
+++ b/bzrlib/branch.py	2011-08-09 13:23:10 +0000
@@ -1545,10 +1545,15 @@
         # For bzr native formats must_fetch is just the tip, and if_present_fetch
         # are the tags.
         must_fetch = set([self.last_revision()])
-        try:
-            if_present_fetch = set(self.tags.get_reverse_tag_dict())
-        except errors.TagsNotSupported:
-            if_present_fetch = set()
+        if_present_fetch = set()
+        c = self.get_config()
+        include_tags = c.get_user_option_as_bool('branch.fetch_tags',
+                                                 default=False)
+        if include_tags:
+            try:
+                if_present_fetch = set(self.tags.get_reverse_tag_dict())
+            except errors.TagsNotSupported:
+                pass
         must_fetch.discard(_mod_revision.NULL_REVISION)
         if_present_fetch.discard(_mod_revision.NULL_REVISION)
         return must_fetch, if_present_fetch

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2011-06-02 08:11:47 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2011-08-09 13:46:26 +0000
@@ -287,6 +287,7 @@
         builder = self.make_branch_builder('source')
         source = fixtures.build_branch_with_non_ancestral_rev(builder)
         source.tags.set_tag('tag-a', 'rev-2')
+        source.get_config().set_user_option('branch.fetch_tags', 'True')
         # Now source has a tag not in its ancestry.  Make a branch from it.
         self.run_bzr('branch source new-branch')
         new_branch = branch.Branch.open('new-branch')
@@ -438,7 +439,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertLength(36, self.hpss_calls)
+        self.assertLength(37, self.hpss_calls)
 
     def test_branch_from_trivial_branch_streaming_acceptance(self):
         self.setup_smart_server_with_call_log()
@@ -453,7 +454,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertLength(9, self.hpss_calls)
+        self.assertLength(10, self.hpss_calls)
 
     def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
         self.setup_smart_server_with_call_log()
@@ -473,12 +474,13 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertLength(14, self.hpss_calls)
+        self.assertLength(15, self.hpss_calls)
 
     def test_branch_from_branch_with_tags(self):
         self.setup_smart_server_with_call_log()
         builder = self.make_branch_builder('source')
         source = fixtures.build_branch_with_non_ancestral_rev(builder)
+        source.get_config().set_user_option('branch.fetch_tags', 'True')
         source.tags.set_tag('tag-a', 'rev-2')
         source.tags.set_tag('tag-missing', 'missing-rev')
         # Now source has a tag not in its ancestry.  Make a branch from it.
@@ -489,7 +491,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertLength(9, self.hpss_calls)
+        self.assertLength(10, self.hpss_calls)
 
     def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self):
         self.setup_smart_server_with_call_log()

=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py	2011-06-13 14:32:13 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py	2011-08-09 13:30:21 +0000
@@ -681,6 +681,7 @@
         builder.build_commit(message="Rev 2a", rev_id='rev-2a')
         source.tags.set_tag('tag-a', 'rev-2a')
         source.set_last_revision_info(1, 'rev-1')
+        source.get_config().set_user_option('branch.fetch_tags', 'True')
         builder.build_commit(message="Rev 2b", rev_id='rev-2b')
         # Merge from source
         self.run_bzr('merge -d target source')

=== modified file 'bzrlib/tests/blackbox/test_pull.py'
--- a/bzrlib/tests/blackbox/test_pull.py	2011-02-11 05:57:31 +0000
+++ b/bzrlib/tests/blackbox/test_pull.py	2011-08-10 14:02:04 +0000
@@ -152,6 +152,7 @@
         # Make a source, sprout a target off it
         builder = self.make_branch_builder('source')
         source = fixtures.build_branch_with_non_ancestral_rev(builder)
+        source.get_config().set_user_option('branch.fetch_tags', 'True')
         target_bzrdir = source.bzrdir.sprout('target')
         source.tags.set_tag('tag-a', 'rev-2')
         # Pull from source
@@ -410,7 +411,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertLength(18, self.hpss_calls)
+        self.assertLength(19, self.hpss_calls)
         remote = Branch.open('stacked')
         self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
     

=== modified file 'bzrlib/tests/per_branch/test_pull.py'
--- a/bzrlib/tests/per_branch/test_pull.py	2011-02-09 06:36:35 +0000
+++ b/bzrlib/tests/per_branch/test_pull.py	2011-08-09 14:18:05 +0000
@@ -156,6 +156,7 @@
         except errors.TagsNotSupported:
             raise TestNotApplicable('format does not support tags.')
         source.tags.set_tag('tag-a', 'rev-2')
+        source.get_config().set_user_option('branch.fetch_tags', 'True')
         target.pull(source)
         # The tag is present, and so is its revision.
         self.assertEqual('rev-2', target.tags.lookup_tag('tag-a'))
@@ -177,6 +178,7 @@
             source.tags.set_tag('tag-a', 'rev-2')
         except errors.TagsNotSupported:
             raise TestNotApplicable('format does not support tags.')
+        source.get_config().set_user_option('branch.fetch_tags', 'True')
         target.pull(source, 'rev-2-again')
         # The tag is present, and so is its revision.
         self.assertEqual('rev-2', target.tags.lookup_tag('tag-a'))

=== modified file 'bzrlib/tests/per_controldir/test_controldir.py'
--- a/bzrlib/tests/per_controldir/test_controldir.py	2011-05-13 12:51:05 +0000
+++ b/bzrlib/tests/per_controldir/test_controldir.py	2011-08-10 14:02:04 +0000
@@ -690,6 +690,7 @@
             source.tags.set_tag('tag-a', 'rev-2')
         except errors.TagsNotSupported:
             raise TestNotApplicable('Branch format does not support tags.')
+        source.get_config().set_user_option('branch.fetch_tags', 'True')
         # Now source has a tag not in its ancestry.  Sprout its controldir.
         dir = source.bzrdir
         target = dir.sprout(self.get_url('target'))
@@ -761,6 +762,7 @@
             source.tags.set_tag('tag-absent', 'absent-rev')
         except errors.TagsNotSupported:
             raise TestNotApplicable('Branch format does not support tags.')
+        source.get_config().set_user_option('branch.fetch_tags', 'True')
         # And ask sprout for C2
         dir = source.bzrdir
         target = dir.sprout(self.get_url('target'), revision_id='rev-c2')

=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py	2011-05-13 12:51:05 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2011-08-10 14:02:04 +0000
@@ -26,6 +26,7 @@
 from bzrlib import (
     branch,
     bzrdir,
+    config,
     controldir,
     errors,
     help_topics,
@@ -1208,7 +1209,7 @@
 
     def __init__(self, *args, **kwargs):
         super(_TestBzrDir, self).__init__(*args, **kwargs)
-        self.test_branch = _TestBranch()
+        self.test_branch = _TestBranch(self.transport)
         self.test_branch.repository = self.create_repository()
 
     def open_branch(self, unsupported=False):
@@ -1225,15 +1226,17 @@
 class _TestBranch(bzrlib.branch.Branch):
     """Test Branch implementation for TestBzrDirSprout."""
 
-    def __init__(self, *args, **kwargs):
+    def __init__(self, transport, *args, **kwargs):
         self._format = _TestBranchFormat()
+        self._transport = transport
+        self.base = transport.base
         super(_TestBranch, self).__init__(*args, **kwargs)
         self.calls = []
         self._parent = None
 
     def sprout(self, *args, **kwargs):
         self.calls.append('sprout')
-        return _TestBranch()
+        return _TestBranch(self._transport)
 
     def copy_content_into(self, destination, revision_id=None):
         self.calls.append('copy_content_into')
@@ -1244,6 +1247,9 @@
     def get_parent(self):
         return self._parent
 
+    def _get_config(self):
+        return config.TransportConfig(self._transport, 'branch.conf')
+
     def set_parent(self, parent):
         self._parent = parent
 

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2011-07-15 08:25:00 +0000
+++ b/bzrlib/tests/test_remote.py	2011-08-09 14:18:05 +0000
@@ -1183,6 +1183,28 @@
         client.add_expected_call(
             'Branch.last_revision_info', ('quack/',),
             'success', ('ok', '1', 'rev-tip'))
+        client.add_expected_call(
+            'Branch.get_config_file', ('quack/',),
+            'success', ('ok',), '')
+        transport.mkdir('quack')
+        transport = transport.clone('quack')
+        branch = self.make_remote_branch(transport, client)
+        result = branch.heads_to_fetch()
+        self.assertFinished(client)
+        self.assertEqual((set(['rev-tip']), set()), result)
+
+    def test_uses_last_revision_info_and_tags_when_set(self):
+        transport = MemoryTransport()
+        client = FakeClient(transport.base)
+        client.add_expected_call(
+            'Branch.get_stacked_on_url', ('quack/',),
+            'error', ('NotStacked',))
+        client.add_expected_call(
+            'Branch.last_revision_info', ('quack/',),
+            'success', ('ok', '1', 'rev-tip'))
+        client.add_expected_call(
+            'Branch.get_config_file', ('quack/',),
+            'success', ('ok',), 'branch.fetch_tags = True')
         # XXX: this will break if the default format's serialization of tags
         # changes, or if the RPC for fetching tags changes from get_tags_bytes.
         client.add_expected_call(
@@ -1213,7 +1235,7 @@
         self.assertFinished(client)
         self.assertEqual((set(['tip']), set(['tagged-1', 'tagged-2'])), result)
 
-    def test_backwards_compatible(self):
+    def make_branch_with_tags(self):
         self.setup_smart_server_with_call_log()
         # Make a branch with a single revision.
         builder = self.make_branch_builder('foo')
@@ -1225,6 +1247,12 @@
         # Add two tags to that branch
         branch.tags.set_tag('tag-1', 'rev-1')
         branch.tags.set_tag('tag-2', 'rev-2')
+        return branch
+
+    def test_backwards_compatible(self):
+        branch = self.make_branch_with_tags()
+        c = branch.get_config()
+        c.set_user_option('branch.fetch_tags', 'True')
         self.addCleanup(branch.lock_read().unlock)
         # Disable the heads_to_fetch verb
         verb = 'Branch.heads_to_fetch'
@@ -1233,7 +1261,23 @@
         result = branch.heads_to_fetch()
         self.assertEqual((set(['tip']), set(['rev-1', 'rev-2'])), result)
         self.assertEqual(
-            ['Branch.last_revision_info', 'Branch.get_tags_bytes'],
+            ['Branch.last_revision_info', 'Branch.get_config_file',
+             'Branch.get_tags_bytes'],
+            [call.call.method for call in self.hpss_calls])
+
+    def test_backwards_compatible_no_tags(self):
+        branch = self.make_branch_with_tags()
+        c = branch.get_config()
+        c.set_user_option('branch.fetch_tags', 'False')
+        self.addCleanup(branch.lock_read().unlock)
+        # Disable the heads_to_fetch verb
+        verb = 'Branch.heads_to_fetch'
+        self.disable_verb(verb)
+        self.reset_smart_call_log()
+        result = branch.heads_to_fetch()
+        self.assertEqual((set(['tip']), set()), result)
+        self.assertEqual(
+            ['Branch.last_revision_info', 'Branch.get_config_file'],
             [call.call.method for call in self.hpss_calls])
 
 

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-08-10 09:38:09 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-08-10 17:01:53 +0000
@@ -61,6 +61,14 @@
 
   (John Arbash Meinel, #609187, #812928)
 
+* Cope with not all Python versions having a ``clear`` method on
+  ``TestCase._type_equality_funcs``.
+  (Martin [gz], Jelmer Vernooij, #809048)
+
+* Fetching tags when fetching the tip revision of a branch is now
+  controlled by the config setting ``branch.fetch_tags``. The behavior has
+  been reverted to 2.3's not-fetching tagged revisions by default.
+  (John Arbash Meinel, #771184)
 
 * The fix for bug #513709 caused us to open a new connection when
   switching a lightweight checkout that was pointing at a bound branch.
@@ -68,9 +76,6 @@
   avoiding an extra SSH connection, etc.
   (John Arbash Meinel, #812285)
 
-* Cope with not all Python versions having a ``clear`` method on
-  ``TestCase._type_equality_funcs``. (#809048, Martin [gz], Jelmer
-  Vernooij)
 
 Documentation
 *************

=== modified file 'doc/en/whats-new/whats-new-in-2.4.txt'
--- a/doc/en/whats-new/whats-new-in-2.4.txt	2011-07-15 09:23:14 +0000
+++ b/doc/en/whats-new/whats-new-in-2.4.txt	2011-08-10 07:30:03 +0000
@@ -38,10 +38,11 @@
 ***************************
 
 When tags are copied from a branch, the associated revisions are now copied
-too.  Previously operations like branching, merging or pulling might have
-copied new tags visible in ``bzr tags``, but not copied the revisions.  Now
-revisions from tags will always be present, so that operations like ``bzr
-log -r tag:foo`` will always work.
+too if the config entry ``branch.fetch_tags`` is set to True.  Operations
+like branching, merging or pulling will still always copy new tags visible
+in ``bzr tags``. When the config is set, it will now also copy the
+revisions and their ancestry.  This way tagged revisions will always be
+present, so that operations like ``bzr log -r tag:foo`` will always work.
 
 Deprecated command synonyms
 ***************************




More information about the bazaar-commits mailing list