Merge lp:~spiv/bzr/fetch-spec-everything-not-in-other into lp:bzr
| Status: | Superseded |
|---|---|
| Proposed branch: | lp:~spiv/bzr/fetch-spec-everything-not-in-other |
| Merge into: | lp:bzr |
| Diff against target: |
981 lines (+488/-74) 13 files modified
bzrlib/fetch.py (+36/-11) bzrlib/graph.py (+174/-2) bzrlib/remote.py (+30/-9) bzrlib/repofmt/knitrepo.py (+19/-11) bzrlib/repofmt/weaverepo.py (+19/-11) bzrlib/repository.py (+94/-18) bzrlib/smart/repository.py (+16/-0) bzrlib/tests/per_interrepository/test_interrepository.py (+9/-2) bzrlib/tests/per_repository_reference/test_fetch.py (+40/-1) bzrlib/tests/test_remote.py (+27/-2) bzrlib/tests/test_repository.py (+1/-1) bzrlib/tests/test_smart.py (+18/-6) doc/en/release-notes/bzr-2.3.txt (+5/-0) |
| To merge this branch: | bzr merge lp:~spiv/bzr/fetch-spec-everything-not-in-other |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| John A Meinel | 2010-11-29 | Needs Fixing on 2010-11-30 | |
|
Review via email:
|
|||
This proposal has been superseded by a proposal from 2010-12-06.
Commit Message
Add EverythingResult, EverythingNotIn
Description of the Change
Like <https:/
This patch defines some new “fetch specs” to be passed as the fetch_spec argument of fetch: EverythingResult, EmptySearchResult, EverythingNotIn
A nice thing about adding these objects is that it shifts logic to handle these different cases out of the innards of fetch.py to somewhere more modular. This in turn means we can support these things better over HPSS, and so this patch does that: the 'everything' search is now added to the network protocol. Happily new verb was needed, we can safely interpret a BadSearch error in this case as meaning we need to fallback.
Another change in this patch is the deprecation of search_
- 5541. By Andrew Bennetts on 2010-11-30
-
Merge fetch-spec-
everything- not-in- other. - 5542. By Andrew Bennetts on 2010-11-30
-
Merge sprout-
does-not- reopen- repo.
| Andrew Bennetts (spiv) wrote : | # |
John A Meinel wrote:
> Review: Needs Fixing
> + if not isinstance(search, graph.Everythin
> ^- can we add an attribute, rather than an isinstance check?
>
> if not search.
Hmm, I can do that, although currently there's no common base class for these
objects, and my gut feeling is that it would be good to keep their interface as
small and simple as possible. So I'm unsure about whether or not to do this. I
think it's probably easier to add this later than it is to remove it later.
> 490 + def _present_
> 491 + """Returns set of all revisions in ancestry of revision_ids present in
> 492 + the source repo.
> 493 +
> 494 + :param revision_ids: if None, all revisions in source are returned.
> 495 + """
> 496 + if revision_ids is not None:
> 497 + # First, ensure all specified revisions exist. Callers expect
> 498 + # NoSuchRevision when they pass absent revision_ids here.
> 499 + revision_ids = set(revision_ids)
> 500 + graph = self.source.
> 501 + present_revs = set(graph.
> 502 + missing = revision_
> 503 + if missing:
> 504 + raise errors.
> 505 + source_ids = [rev_id for (rev_id, parents) in
> 506 + self.source.
> 507 + if rev_id != _mod_revision.
> 508 + and parents is not None]
> ^- you have "graph = self.source.
Fixed, thanks for spotting that. I think it occurred because I initially
copy-and-pasted the list comprehension from graph.py.
> 145 + def get_recipe(self):
> 146 + raise NotImplementedE
> 147 +
> 148 + def get_network_
> 149 + return ('everything',)
>
> Why don't EverythingNotIn
Because they are a different kind of object. Obviously that's not clear enough
in the current code!
The names could stand to be improved, but there are basically two kinds of
“fetch spec” in this patch:
* a network-ready search result: SearchResult, PendingAncestry
EverythingRe
(I'm not certain that's the perfect design, but it's not too far off.)
* a lightweight object that can be resolved into a network-ready search result
later: EverythingNotIn
method that inspects the repository/ies to generate the search result.
> Overall, I think these changes seem good, but I don't really see how this gets
> us closer to computing a search without having one end doing a step-by-step
> search. (Certainly you're still using the same 'search_
> and you don't seem to be serializing anything over the wire...)
Right, this change isn't meant to solve that problem. The concrete performance
issue they help with is in the next patch, fetch-all-
and easy for the sprout code to request a fetch of all tags at the
same time as the tip.
Separately...
- 5543. By Andrew Bennetts on 2010-12-06
-
Merge fetch-spec-
everything- not-in- other. - 5544. By Andrew Bennetts on 2010-12-07
-
Merge fetch-spec-
everything- not-in- other. - 5545. By Andrew Bennetts on 2010-12-15
-
Merge latest fetch-spec-
everything- not-in- other. - 5546. By Andrew Bennetts on 2010-12-21
-
Fix docstring typo.
- 5547. By Andrew Bennetts on 2011-01-04
-
Fix test_fetch_
everything_ backwards_ compat to actually test what it is intended to test. - 5548. By Andrew Bennetts on 2011-01-12
-
Rename get_search_result to execute, require a SearchResult (and not a search) be passed to fetch.
- 5549. By Andrew Bennetts on 2011-01-12
-
Merge lp:bzr
- 5550. By Andrew Bennetts on 2011-02-07
-
Merge lp:bzr.
- 5551. By Andrew Bennetts on 2011-02-07
-
Update an occurrence of '2.3' that should be '2.4'.

+ if not isinstance(search, graph.Everythin gResult) :
^- can we add an attribute, rather than an isinstance check?
if not search. is_everything( ):
490 + def _present_ source_ revisions_ for(self, revision_ids): get_graph( ) get_parent_ map(revision_ ids)) ids.difference( present_ revs) NoSuchRevision( self.source, missing.pop()) get_graph( ).iter_ ancestry( revision_ ids) NULL_REVISION get_graph( )" and then you inline "self.source. get_graph( )" into the source_ids list comprehension. Better to re-use the graph object.
491 + """Returns set of all revisions in ancestry of revision_ids present in
492 + the source repo.
493 +
494 + :param revision_ids: if None, all revisions in source are returned.
495 + """
496 + if revision_ids is not None:
497 + # First, ensure all specified revisions exist. Callers expect
498 + # NoSuchRevision when they pass absent revision_ids here.
499 + revision_ids = set(revision_ids)
500 + graph = self.source.
501 + present_revs = set(graph.
502 + missing = revision_
503 + if missing:
504 + raise errors.
505 + source_ids = [rev_id for (rev_id, parents) in
506 + self.source.
507 + if rev_id != _mod_revision.
508 + and parents is not None]
^- you have "graph = self.source.
145 + def get_recipe(self): rror(self. get_recipe) struct( self):
146 + raise NotImplementedE
147 +
148 + def get_network_
149 + return ('everything',)
Why don't EverythingNotIn Other and NotInOtherForRevs implement these functions?
Overall, I think these changes seem good, but I don't really see how this gets us closer to computing a search without having one end doing a step-by-step search. (Certainly you're still using the same 'search_ missing_ revision_ ids', and you don't seem to be serializing anything over the wire...)