/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/hashcache.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from __future__ import absolute_import
18
 
 
19
17
# TODO: Up-front, stat all files in order and remove those which are deleted or
20
18
# out-of-date.  Don't actually re-read them until they're needed.  That ought
21
19
# to bring all the inodes into core so that future stats to them are fast, and
41
39
    osutils,
42
40
    trace,
43
41
    )
44
 
from .sixish import (
45
 
    text_type,
46
 
    viewitems,
47
 
    )
48
42
 
49
43
 
50
44
FP_MTIME_COLUMN = 1
97
91
            parameters and returns a stack of ContentFilters.
98
92
            If None, no content filtering is performed.
99
93
        """
100
 
        if not isinstance(root, text_type):
 
94
        if not isinstance(root, str):
101
95
            raise ValueError("Base dir for hashcache must be text")
102
96
        self.root = root
103
97
        self.hit_count = 0
131
125
        # Stat in inode order as optimisation for at least linux.
132
126
        def inode_order(path_and_cache):
133
127
            return path_and_cache[1][1][3]
134
 
        for path, cache_val in sorted(viewitems(self._cache), key=inode_order):
 
128
        for path, cache_val in sorted(self._cache.items(), key=inode_order):
135
129
            abspath = osutils.pathjoin(self.root, path)
136
130
            fp = self._fingerprint(abspath)
137
131
            self.stat_count += 1
173
167
            if self._filter_provider is None:
174
168
                filters = []
175
169
            else:
176
 
                filters = self._filter_provider(path=path, file_id=None)
 
170
                filters = self._filter_provider(path=path)
177
171
            digest = self._really_sha1_file(abspath, filters)
178
172
        elif stat.S_ISLNK(mode):
179
173
            target = osutils.readlink(abspath)
223
217
                                   new_mode=self._mode) as outf:
224
218
            outf.write(CACHE_HEADER)
225
219
 
226
 
            for path, c in viewitems(self._cache):
 
220
            for path, c in self._cache.items():
227
221
                line_info = [path.encode('utf-8'), b'// ', c[0], b' ']
228
222
                line_info.append(b'%d %d %d %d %d %d' % c[1])
229
223
                line_info.append(b'\n')