/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/vf_search.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 00:06:46 UTC
  • mfrom: (6673 work)
  • mto: This revision was merged to the branch mainline in revision 6675.
  • Revision ID: jelmer@jelmer.uk-20170610000646-xj6jh277lo4xuo10
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from __future__ import absolute_import
20
20
 
 
21
import itertools
 
22
 
21
23
from . import (
22
24
    debug,
23
25
    revision,
29
31
    Graph,
30
32
    invert_parent_map,
31
33
    )
 
34
from .sixish import (
 
35
    viewvalues,
 
36
    )
32
37
 
33
38
 
34
39
class AbstractSearchResult(object):
35
40
    """The result of a search, describing a set of keys.
36
 
    
 
41
 
37
42
    Search results are typically used as the 'fetch_spec' parameter when
38
43
    fetching revisions.
39
44
 
380
385
    # start_set is all the keys in the cache
381
386
    start_set = set(parent_map)
382
387
    # result set is all the references to keys in the cache
383
 
    result_parents = set()
384
 
    for parents in parent_map.itervalues():
385
 
        result_parents.update(parents)
 
388
    result_parents = set(itertools.chain.from_iterable(viewvalues(parent_map)))
386
389
    stop_keys = result_parents.difference(start_set)
387
390
    # We don't need to send ghosts back to the server as a position to
388
391
    # stop either.
420
423
            next_revs = next(s)
421
424
        except StopIteration:
422
425
            break
423
 
        for parents in s._current_parents.itervalues():
 
426
        for parents in viewvalues(s._current_parents):
424
427
            f_heads = heads.intersection(parents)
425
428
            if f_heads:
426
429
                found_heads.update(f_heads)
427
430
        stop_keys = exclude_keys.intersection(next_revs)
428
431
        if stop_keys:
429
432
            s.stop_searching_any(stop_keys)
430
 
    for parents in s._current_parents.itervalues():
 
433
    for parents in viewvalues(s._current_parents):
431
434
        f_heads = heads.intersection(parents)
432
435
        if f_heads:
433
436
            found_heads.update(f_heads)