[MERGE] Replace Repository.get_data_stream with get_data_stream_for_search
John Arbash Meinel
john at arbash-meinel.com
Thu Jan 17 19:59:30 GMT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> This new API takes a SearchResult rather than a simple list of
> revisions. Next step - smart server verb changes.
>
> -Rob
>
Is this "for_search" or "from_search"...
- - self._fetch_everything_for_revisions(revs, pp)
+ 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)
finally:
^- Doesn't this need to be "search.get_keys()" not "search.get_keys" ?
This would also indicate that the backward compatibility section is not
being tested.
I wonder if a simple:
fetcher = X()
del searcher._fetch_everything_for_search
fetcher.fetch()
would be a way to test it.
...
> === modified file 'bzrlib/remote.py'
> --- bzrlib/remote.py 2008-01-14 22:48:07 +0000
> +++ bzrlib/remote.py 2008-01-17 05:30:53 +0000
> @@ -691,6 +691,30 @@
> """RemoteRepositories never create working trees by default."""
> return False
>
> + def revision_ids_to_search_result(self, result_set):
> + """Convert a set of revision ids to a graph SearchResult."""
> + result_parents = set()
> + for parents in self.get_graph().get_parent_map(
> + result_set).itervalues():
> + result_parents.update(parents)
> + included_keys = result_set.intersection(result_parents)
> + start_keys = result_set.difference(included_keys)
> + exclude_keys = result_parents.difference(result_set)
> + result = graph.SearchResult(start_keys, exclude_keys,
> + len(result_set), result_set)
> + return result
^- This looks oddly familiar. Is it a copy and paste from your other
location? Is it possible to factor out the duplicate code?
> - def get_data_stream(self, revision_ids):
> + def get_data_stream_for_search(self, search):
> + revision_ids = search.get_keys()
^- don't we need to leave a function "get_data_stream" in the Class and
just deprecate it?
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHj7OhJdeBCYSNAAMRAji3AJsFEWRqd6WZ0eInojPsKYMAB7O90gCgwJtH
pwwkGCEl+qzj/Kru/xbfw+Q=
=Yn8v
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list