[BUG] in backwards compatibility code for fetch()

John Arbash Meinel john at arbash-meinel.com
Mon Apr 14 16:43:13 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The RepoFetcher used to use the _fetch_everything_for_revisions() function
before Robert introduced _fetch_everything_for_search().

However, in his update, he actually broke the fallback code, I'm pretty sure
this fixes is:
=== modified file 'bzrlib/fetch.py'
- --- bzrlib/fetch.py     2008-04-09 20:13:46 +0000
+++ bzrlib/fetch.py     2008-04-14 15:39:15 +0000
@@ -138,7 +138,7 @@
~                 self._fetch_everything_for_search(search, pp)
~             else:
~                 # backward compatibility
- -                self._fetch_everything_for_revisions(search.get_keys, pp)
+                self._fetch_everything_for_revisions(search.get_keys(), pp)
~         finally:
~             self.pb.clear()

However, I don't think that code path helps us for anything.

Specifically:

1) If anything was using it, it would be failing, and we would know about it.

2) _fetch_everything_for_search is defined on the base class. Which means that
no child inheriting from it will be missing the function, so we won't ever take
that code path. They would have to explicitly delete the function from the class
definition somehow.

This is also because __fetch() [where this code is] is private, so very unlikely
that a class would have __fetch() and not _fetch_everything_for_search.

So the other possible fix is just:
=== modified file 'bzrlib/fetch.py'
- --- bzrlib/fetch.py     2008-04-09 20:13:46 +0000
+++ bzrlib/fetch.py     2008-04-14 15:42:16 +0000
@@ -134,11 +134,7 @@
~             search = self._revids_to_fetch()
~             if search is None:
~                 return
- -            if getattr(self, '_fetch_everything_for_search', None) is not None:
- -                self._fetch_everything_for_search(search, pp)
- -            else:
- -                # backward compatibility
- -                self._fetch_everything_for_revisions(search.get_keys, pp)
+            self._fetch_everything_for_search(search, pp)
~         finally:
~             self.pb.clear()


Note, I didn't actually run into this problem, I was debugging something else
and I found the code path to look funny. Especially since
_fetch_everything_for_revisions no longer exists in our code base.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgDe5EACgkQJdeBCYSNAAPBPwCdEDlv2KJcCRJsykS5wFt5lvr3
CroAoJ+rIKzxRaExHYUeG0oxETkL5u5e
=/SSV
-----END PGP SIGNATURE-----



More information about the bazaar mailing list