~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • Committer: Ian Clatworthy
  • Date: 2008-05-26 06:36:40 UTC
  • mto: (4171.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 4173.
  • Revision ID: ian.clatworthy@canonical.com-20080526063640-lxfbq6nffa3bma6s
first round of changes from abentley's review

Show diffs side-by-side

added added

removed removed

Lines of Context:
310
310
        :param path: The path at which the dirstate file on disk should live.
311
311
        :param content_filter_stack_provider: a function that takes a
312
312
            path (relative to the top of the tree) and a file-id as
313
 
            parameters and returns a stack of ContentFilter's.
 
313
            parameters and returns a stack of ContentFilters.
314
314
            If None, no content filtering is performed.
315
315
        """
316
316
        # _header_state and _dirblock_state represent the current state
344
344
        self._split_path_cache = {}
345
345
        self._bisect_page_size = DirState.BISECT_PAGE_SIZE
346
346
        if 'hashcache' in debug.debug_flags:
347
 
            self._sha1_file = self._sha1_file_and_mutter
 
347
            self._size_sha1_file = self._sha1_file_and_mutter
348
348
        else:
349
 
            self._sha1_file = filters.sha_file_by_name
 
349
            self._size_sha1_file = filters.internal_size_sha_file_byname
350
350
        # These two attributes provide a simple cache for lookups into the
351
351
        # dirstate in-memory vectors. By probing respectively for the last
352
352
        # block, and for the next entry, we save nearly 2 bisections per path
354
354
        self._last_block_index = None
355
355
        self._last_entry_index = None
356
356
        # Content filtering setup
357
 
        self._cfs_provider = content_filter_stack_provider
 
357
        self._filter_provider = content_filter_stack_provider
358
358
 
359
359
    def __repr__(self):
360
360
        return "%s(%r)" % \
1499
1499
        # process this entry.
1500
1500
        link_or_sha1 = None
1501
1501
        if minikind == 'f':
1502
 
            if self._cfs_provider is None:
 
1502
            if self._filter_provider is None:
1503
1503
                filter_list = []
1504
1504
            else:
1505
1505
                relpath = osutils.pathjoin(entry[0][0], entry[0][1])
1506
 
                file_id=entry[0][2]
1507
 
                filter_list = self._cfs_provider(relpath, file_id)
1508
 
            link_or_sha1 = self._sha1_file(abspath, filter_list)
 
1506
                file_id = entry[0][2]
 
1507
                filter_list = self._filter_provider(relpath, file_id)
 
1508
            link_or_sha1 = self._size_sha1_file(abspath, filter_list)[1]
1509
1509
            executable = self._is_executable(stat_value.st_mode,
1510
1510
                                             saved_executable)
1511
1511
            if self._cutoff_time is None:
1563
1563
        # when -Dhashcache is turned on, this is monkey-patched in to log
1564
1564
        # file reads
1565
1565
        trace.mutter("dirstate sha1 " + abspath)
1566
 
        return filters.sha_file_by_name(abspath, filter_list)
 
1566
        return filters.internal_size_sha_file_byname(abspath, filter_list)
1567
1567
 
1568
1568
    def _is_executable(self, mode, old_executable):
1569
1569
        """Is this file executable?"""
1961
1961
 
1962
1962
        :param content_filter_stack_provider: a function that takes a
1963
1963
            path (relative to the top of the tree) and a file-id as
1964
 
            parameters and returns a stack of ContentFilter's.
 
1964
            parameters and returns a stack of ContentFilters.
1965
1965
            If None, no content filtering is performed.
1966
1966
        :return: An unlocked DirState object, associated with the given path.
1967
1967
        """