/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 bzrlib/knit.py

  • Committer: John Arbash Meinel
  • Date: 2009-11-06 18:05:03 UTC
  • mto: This revision was merged to the branch mainline in revision 4814.
  • Revision ID: john@arbash-meinel.com-20091106180503-q3hcg1nxmut5b2cb
Stop holding the gil while extracting data.

Previous experience has shown that we don't really spend a lot
of time here, but there isn't any reason to hold the lock while
we do it anyway.

Performance testing has shown that for bzr operations 'with nogil'
doesn't really do much, which was generally expected. Any variation
observed is within the noise margins.

This is mostly about 'the right thing to do', and potential
future work where we may actually use threads.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
69
69
    lru_cache,
70
70
    pack,
71
71
    progress,
72
 
    static_tuple,
73
72
    trace,
74
73
    tsort,
75
74
    tuned_gzip,
76
 
    ui,
77
75
    )
78
76
""")
79
77
from bzrlib import (
1756
1754
        :return: An iterator over (line, key).
1757
1755
        """
1758
1756
        if pb is None:
1759
 
            pb = ui.ui_factory.nested_progress_bar()
 
1757
            pb = progress.DummyProgress()
1760
1758
        keys = set(keys)
1761
1759
        total = len(keys)
1762
1760
        done = False
2946
2944
        if not random_id:
2947
2945
            present_nodes = self._get_entries(keys)
2948
2946
            for (index, key, value, node_refs) in present_nodes:
2949
 
                parents = node_refs[:1]
2950
 
                # Sometimes these are passed as a list rather than a tuple
2951
 
                passed = static_tuple.as_tuples(keys[key])
2952
 
                passed_parents = passed[1][:1]
2953
2947
                if (value[0] != keys[key][0][0] or
2954
 
                    parents != passed_parents):
2955
 
                    node_refs = static_tuple.as_tuples(node_refs)
 
2948
                    node_refs[:1] != keys[key][1][:1]):
2956
2949
                    raise KnitCorrupt(self, "inconsistent details in add_records"
2957
 
                        ": %s %s" % ((value, node_refs), passed))
 
2950
                        ": %s %s" % ((value, node_refs), keys[key]))
2958
2951
                del keys[key]
2959
2952
        result = []
2960
2953
        if self._parents: