~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • Committer: Ian Clatworthy
  • Date: 2008-04-23 05:12:12 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-20080423051212-qmlwrnkd2yxjjaci
incorporate jameinel's review feedback

Show diffs side-by-side

added added

removed removed

Lines of Context:
308
308
        """Create a  DirState object.
309
309
 
310
310
        :param path: The path at which the dirstate file on disk should live.
311
 
        :param content_filter_stack_provider: a function that expects a
312
 
            path (relative to the top of the tree) as a parameter and
313
 
            returns the stack of ContentFilter's for that path. If None,
314
 
            no content filtering is performed.
 
311
        :param content_filter_stack_provider: a function that takes a
 
312
            path (relative to the top of the tree) and a file-id as
 
313
            parameters and returns a stack of ContentFilter's.
 
314
            If None, no content filtering is performed.
315
315
        """
316
316
        # _header_state and _dirblock_state represent the current state
317
317
        # of the dirstate metadata and the per-row data respectiely.
1497
1497
        link_or_sha1 = None
1498
1498
        if minikind == 'f':
1499
1499
            if self._cfs_provider is None:
1500
 
                filters_ = None
 
1500
                filter_list = []
1501
1501
            else:
1502
1502
                relpath = osutils.pathjoin(entry[0][0], entry[0][1])
1503
 
                filters_ = self._cfs_provider(relpath)
1504
 
            link_or_sha1 = self._sha1_file(abspath, filters_)
 
1503
                file_id=entry[0][2]
 
1504
                filter_list = self._cfs_provider(relpath, file_id)
 
1505
            link_or_sha1 = self._sha1_file(abspath, filter_list)
1505
1506
            executable = self._is_executable(stat_value.st_mode,
1506
1507
                                             saved_executable)
1507
1508
            if self._cutoff_time is None:
1555
1556
        """Return the os.lstat value for this path."""
1556
1557
        return os.lstat(abspath)
1557
1558
 
1558
 
    def _sha1_file_and_mutter(self, abspath, filters_):
 
1559
    def _sha1_file_and_mutter(self, abspath, filter_list):
1559
1560
        # when -Dhashcache is turned on, this is monkey-patched in to log
1560
1561
        # file reads
1561
1562
        trace.mutter("dirstate sha1 " + abspath)
1562
 
        return filters.sha_file_by_name(abspath, filters_)
 
1563
        return filters.sha_file_by_name(abspath, filter_list)
1563
1564
 
1564
1565
    def _is_executable(self, mode, old_executable):
1565
1566
        """Is this file executable?"""
1955
1956
    def on_file(path, content_filter_stack_provider=None):
1956
1957
        """Construct a DirState on the file at path path.
1957
1958
 
1958
 
        :param content_filter_stack_provider: a function that expects a
1959
 
            path (relative to the top of the tree) as a parameter and
1960
 
            returns the stack of ContentFilter's for that path. If None,
1961
 
            no content filtering is performed.
 
1959
        :param content_filter_stack_provider: a function that takes a
 
1960
            path (relative to the top of the tree) and a file-id as
 
1961
            parameters and returns a stack of ContentFilter's.
 
1962
            If None, no content filtering is performed.
1962
1963
        :return: An unlocked DirState object, associated with the given path.
1963
1964
        """
1964
1965
        result = DirState(path, content_filter_stack_provider)