Rev 6409: (vila) Migrate the 'branch.fetch_tags' option to config stacks. (Vincent in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jan 2 10:24:03 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6409 [merge]
revision-id: pqm at pqm.ubuntu.com-20120102102402-f8tlazxhdypu44ej
parent: pqm at pqm.ubuntu.com-20111230155159-qrgafyvytuitiq8u
parent: v.ladeuil+lp at free.fr-20111227175109-yrzttnhyhqzsdpf5
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2012-01-02 10:24:02 +0000
message:
  (vila) Migrate the 'branch.fetch_tags' option to config stacks. (Vincent
   Ladeuil)
modified:
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  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
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2011-12-30 15:00:07 +0000
+++ b/bzrlib/branch.py	2012-01-02 10:24:02 +0000
@@ -1566,14 +1566,11 @@
             heads that must be fetched if present, but no error is necessary if
             they are not present.
         """
-        # For bzr native formats must_fetch is just the tip, and if_present_fetch
-        # are the tags.
+        # For bzr native formats must_fetch is just the tip, and
+        # if_present_fetch are the tags.
         must_fetch = set([self.last_revision()])
         if_present_fetch = set()
-        c = self.get_config()
-        include_tags = c.get_user_option_as_bool('branch.fetch_tags',
-                                                 default=False)
-        if include_tags:
+        if self.get_config_stack().get('branch.fetch_tags'):
             try:
                 if_present_fetch = set(self.tags.get_reverse_tag_dict())
             except errors.TagsNotSupported:

=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-12-21 21:31:03 +0000
+++ b/bzrlib/config.py	2011-12-27 12:18:36 +0000
@@ -2634,6 +2634,11 @@
 See also: bound.
 """))
 option_registry.register(
+    Option('branch.fetch_tags', default=False,  from_unicode=bool_from_store,
+           help="""\
+Whether revisions associated with tags should be fetched.
+"""))
+option_registry.register(
     Option('bzr.workingtree.worth_saving_limit', default=10,
            from_unicode=int_from_store,  invalid='warning',
            help='''\

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2011-12-24 10:10:59 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2012-01-02 10:24:02 +0000
@@ -331,7 +331,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')
+        source.get_config_stack().set('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')
@@ -531,7 +531,7 @@
         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.get_config_stack().set('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.

=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py	2011-08-09 13:30:21 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py	2011-12-27 12:18:36 +0000
@@ -681,7 +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')
+        source.get_config_stack().set('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-12-14 20:21:52 +0000
+++ b/bzrlib/tests/blackbox/test_pull.py	2012-01-02 10:24:02 +0000
@@ -155,7 +155,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')
+        source.get_config_stack().set('branch.fetch_tags', True)
         target_bzrdir = source.bzrdir.sprout('target')
         source.tags.set_tag('tag-a', 'rev-2')
         # Pull from source

=== modified file 'bzrlib/tests/per_branch/test_pull.py'
--- a/bzrlib/tests/per_branch/test_pull.py	2011-10-17 08:45:09 +0000
+++ b/bzrlib/tests/per_branch/test_pull.py	2011-12-27 12:18:36 +0000
@@ -155,7 +155,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')
+        source.get_config_stack().set('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,7 +177,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')
+        source.get_config_stack().set('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-12-12 12:08:58 +0000
+++ b/bzrlib/tests/per_controldir/test_controldir.py	2011-12-27 12:18:36 +0000
@@ -746,7 +746,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')
+        source.get_config_stack().set('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'))
@@ -825,7 +825,7 @@
             has_ghost_tag = False
         else:
             has_ghost_tag = True
-        source.get_config().set_user_option('branch.fetch_tags', 'True')
+        source.get_config_stack().set('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-12-22 18:02:01 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2012-01-02 10:24:02 +0000
@@ -1298,6 +1298,9 @@
     def _get_config(self):
         return config.TransportConfig(self._transport, 'branch.conf')
 
+    def _get_config_store(self):
+        return config.BranchStore(self)
+
     def set_parent(self, parent):
         self._parent = parent
 

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2011-12-30 00:30:43 +0000
+++ b/bzrlib/tests/test_remote.py	2012-01-02 10:24:02 +0000
@@ -1434,8 +1434,8 @@
 
     def test_backwards_compatible(self):
         branch = self.make_branch_with_tags()
-        c = branch.get_config()
-        c.set_user_option('branch.fetch_tags', 'True')
+        c = branch.get_config_stack()
+        c.set('branch.fetch_tags', True)
         self.addCleanup(branch.lock_read().unlock)
         # Disable the heads_to_fetch verb
         verb = 'Branch.heads_to_fetch'
@@ -1450,8 +1450,8 @@
 
     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')
+        c = branch.get_config_stack()
+        c.set('branch.fetch_tags', False)
         self.addCleanup(branch.lock_read().unlock)
         # Disable the heads_to_fetch verb
         verb = 'Branch.heads_to_fetch'




More information about the bazaar-commits mailing list