2738
2736
raise errors.ObjectNotLocked(self)
2741
def py_update_entry(self, entry, abspath, stat_value,
2739
def py_update_entry(state, entry, abspath, stat_value,
2742
2740
_stat_to_minikind=DirState._stat_to_minikind,
2743
2741
_pack_stat=pack_stat):
2744
2742
"""Update the entry based on what is actually on disk.
2744
:param state: The dirstate this entry is in.
2746
2745
:param entry: This is the dirblock entry for the file in question.
2747
2746
:param abspath: The path on disk for this file.
2748
:param stat_value: (optional) if we already have done a stat on the
2747
:param stat_value: The stat value done on the path.
2750
2748
:return: The sha1 hexdigest of the file (40 bytes) or link target of a
2774
2772
# process this entry.
2775
2773
link_or_sha1 = None
2776
2774
if minikind == 'f':
2777
link_or_sha1 = self._sha1_file(abspath)
2778
executable = self._is_executable(stat_value.st_mode,
2775
link_or_sha1 = state._sha1_file(abspath)
2776
executable = state._is_executable(stat_value.st_mode,
2779
2777
saved_executable)
2780
if self._cutoff_time is None:
2781
self._sha_cutoff_time()
2782
if (stat_value.st_mtime < self._cutoff_time
2783
and stat_value.st_ctime < self._cutoff_time):
2778
if state._cutoff_time is None:
2779
state._sha_cutoff_time()
2780
if (stat_value.st_mtime < state._cutoff_time
2781
and stat_value.st_ctime < state._cutoff_time):
2784
2782
entry[1][0] = ('f', link_or_sha1, stat_value.st_size,
2785
2783
executable, packed_stat)
2794
2792
# have a directory block for it. This doesn't happen very
2795
2793
# often, so this doesn't have to be super fast.
2796
2794
block_index, entry_index, dir_present, file_present = \
2797
self._get_block_entry_index(entry[0][0], entry[0][1], 0)
2798
self._ensure_block(block_index, entry_index,
2795
state._get_block_entry_index(entry[0][0], entry[0][1], 0)
2796
state._ensure_block(block_index, entry_index,
2799
2797
osutils.pathjoin(entry[0][0], entry[0][1]))
2800
2798
elif minikind == 'l':
2801
link_or_sha1 = self._read_link(abspath, saved_link_or_sha1)
2802
if self._cutoff_time is None:
2803
self._sha_cutoff_time()
2804
if (stat_value.st_mtime < self._cutoff_time
2805
and stat_value.st_ctime < self._cutoff_time):
2799
link_or_sha1 = state._read_link(abspath, saved_link_or_sha1)
2800
if state._cutoff_time is None:
2801
state._sha_cutoff_time()
2802
if (stat_value.st_mtime < state._cutoff_time
2803
and stat_value.st_ctime < state._cutoff_time):
2806
2804
entry[1][0] = ('l', link_or_sha1, stat_value.st_size,
2807
2805
False, packed_stat)
2809
2807
entry[1][0] = ('l', '', stat_value.st_size,
2810
2808
False, DirState.NULLSTAT)
2811
self._dirblock_state = DirState.IN_MEMORY_MODIFIED
2809
state._dirblock_state = DirState.IN_MEMORY_MODIFIED
2812
2810
return link_or_sha1
2813
2811
update_entry = py_update_entry
2848
2846
self.want_unversioned = want_unversioned
2849
2847
self.tree = tree
2851
def _process_entry(self, entry, path_info):
2849
def _process_entry(self, entry, path_info, pathjoin=osutils.pathjoin):
2852
2850
"""Compare an entry and real disk to generate delta information.
2854
2852
:param path_info: top_relpath, basename, kind, lstat, abspath for
3109
3107
def iter_changes(self):
3110
3108
"""Iterate over the changes."""
3111
3109
utf8_decode = cache_utf8._utf8_decode
3112
cmp_by_dirs = bzrlib.dirstate.cmp_by_dirs
3110
_cmp_by_dirs = cmp_by_dirs
3113
3111
_process_entry = self._process_entry
3114
3112
uninteresting = self.uninteresting
3115
3113
search_specific_files = self.search_specific_files
3116
3114
searched_specific_files = self.searched_specific_files
3115
splitpath = osutils.splitpath
3118
3117
# compare source_index and target_index at or under each element of search_specific_files.
3119
3118
# follow the following comparison table. Note that we only want to do diff operations when
3251
3250
current_block is not None):
3252
3251
if (current_dir_info and current_block
3253
3252
and current_dir_info[0][0] != current_block[0]):
3254
if cmp_by_dirs(current_dir_info[0][0], current_block[0]) < 0:
3253
if _cmp_by_dirs(current_dir_info[0][0], current_block[0]) < 0:
3255
3254
# filesystem data refers to paths not covered by the dirblock.
3256
3255
# this has two possibilities:
3257
3256
# A) it is versioned but empty, so there is no block for it
3450
3449
_bisect_path_right_c as _bisect_path_right,
3451
3450
cmp_by_dirs_c as cmp_by_dirs,
3452
3451
ProcessEntryC as _process_entry,
3452
update_entry as update_entry,
3454
3454
except ImportError:
3455
3455
from bzrlib._dirstate_helpers_py import (