~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_pyx.pyx

  • Committer: Jelmer Vernooij
  • Date: 2011-04-21 20:32:16 UTC
  • mfrom: (5809.1.2 pwit1)
  • mto: This revision was merged to the branch mainline in revision 5821.
  • Revision ID: jelmer@samba.org-20110421203216-r04j4x5vugrup6u9
Merge per-wt-inventory-tests-pt1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
866
866
    # _st mode of the compiled stat objects.
867
867
    cdef int minikind, saved_minikind
868
868
    cdef void * details
 
869
    cdef int worth_saving
869
870
    minikind = minikind_from_mode(stat_value.st_mode)
870
871
    if 0 == minikind:
871
872
        return None
900
901
    # If we have gotten this far, that means that we need to actually
901
902
    # process this entry.
902
903
    link_or_sha1 = None
 
904
    worth_saving = 1
903
905
    if minikind == c'f':
904
906
        executable = self._is_executable(stat_value.st_mode,
905
907
                                         saved_executable)
916
918
            entry[1][0] = ('f', link_or_sha1, stat_value.st_size,
917
919
                           executable, packed_stat)
918
920
        else:
919
 
            entry[1][0] = ('f', '', stat_value.st_size,
920
 
                           executable, DirState.NULLSTAT)
 
921
            # This file is not worth caching the sha1. Either it is too new, or
 
922
            # it is newly added. Regardless, the only things we are changing
 
923
            # are derived from the stat, and so are not worth caching. So we do
 
924
            # *not* set the IN_MEMORY_MODIFIED flag. (But we'll save the
 
925
            # updated values if there is *other* data worth saving.)
 
926
            entry[1][0] = ('f', '', stat_value.st_size, executable,
 
927
                           DirState.NULLSTAT)
 
928
            worth_saving = 0
921
929
    elif minikind == c'd':
922
 
        link_or_sha1 = None
923
930
        entry[1][0] = ('d', '', 0, False, packed_stat)
924
931
        if saved_minikind != c'd':
925
932
            # This changed from something into a directory. Make sure we
929
936
                self._get_block_entry_index(entry[0][0], entry[0][1], 0)
930
937
            self._ensure_block(block_index, entry_index,
931
938
                               pathjoin(entry[0][0], entry[0][1]))
 
939
        else:
 
940
            # Any changes are derived trivially from the stat object, not worth
 
941
            # re-writing a dirstate for just this
 
942
            worth_saving = 0
932
943
    elif minikind == c'l':
933
944
        link_or_sha1 = self._read_link(abspath, saved_link_or_sha1)
934
945
        if self._cutoff_time is None:
940
951
        else:
941
952
            entry[1][0] = ('l', '', stat_value.st_size,
942
953
                           False, DirState.NULLSTAT)
943
 
    self._dirblock_state = DirState.IN_MEMORY_MODIFIED
 
954
    if worth_saving:
 
955
        self._dirblock_state = DirState.IN_MEMORY_MODIFIED
944
956
    return link_or_sha1
945
957
 
946
958