~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_pyx.pyx

  • Committer: John Arbash Meinel
  • Date: 2011-05-11 11:35:28 UTC
  • mto: This revision was merged to the branch mainline in revision 5851.
  • Revision ID: john@arbash-meinel.com-20110511113528-qepibuwxicjrbb2h
Break compatibility with python <2.6.

This includes auditing the code for places where we were doing
explicit 'sys.version' checks and removing them as appropriate.

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':
 
944
        if saved_minikind == c'l':
 
945
            # If the object hasn't changed kind, it isn't worth saving the
 
946
            # dirstate just for a symlink. The default is 'fast symlinks' which
 
947
            # save the target in the inode entry, rather than separately. So to
 
948
            # stat, we've already read everything off disk.
 
949
            worth_saving = 0
933
950
        link_or_sha1 = self._read_link(abspath, saved_link_or_sha1)
934
951
        if self._cutoff_time is None:
935
952
            self._sha_cutoff_time()
940
957
        else:
941
958
            entry[1][0] = ('l', '', stat_value.st_size,
942
959
                           False, DirState.NULLSTAT)
943
 
    self._dirblock_state = DirState.IN_MEMORY_MODIFIED
 
960
    if worth_saving:
 
961
        # Note, even though _mark_modified will only set
 
962
        # IN_MEMORY_HASH_MODIFIED, it still isn't worth 
 
963
        self._mark_modified([entry])
944
964
    return link_or_sha1
945
965
 
946
966