~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_c.pyx

More Cification, removing redundant string comparisons

Show diffs side-by-side

added added

removed removed

Lines of Context:
1033
1033
            Basename is returned as a utf8 string because we expect this
1034
1034
            tuple will be ignored, and don't want to take the time to
1035
1035
            decode.
1036
 
        :return: None if these don't match
 
1036
        :return: None if the these don't match
1037
1037
                 A tuple of information about the change, or
1038
1038
                 the object 'uninteresting' if these match, but are
1039
1039
                 basically identical.
1281
1281
                self.search_specific_files.add(target_details[1])
1282
1282
        elif ((source_minikind == c'r' or source_minikind == c'a') and
1283
1283
              (target_minikind == c'r' or target_minikind == c'a')):
1284
 
            # neither of the selected trees contain this file,
 
1284
            # neither of the selected trees contain this path,
1285
1285
            # so skip over it. This is not currently directly tested, but
1286
1286
            # is indirectly via test_too_much.TestCommands.test_conflicts.
1287
1287
            pass
1600
1600
            cdef object current_entry
1601
1601
            cdef object current_path_info
1602
1602
            cdef int path_handled
 
1603
            cdef char minikind
 
1604
            cdef int cmp_result
1603
1605
            # cdef char * temp_str
1604
1606
            # cdef Py_ssize_t temp_str_length
1605
1607
            # PyString_AsStringAndSize(disk_kind, &temp_str, &temp_str_length)
1640
1642
                    if result is not None:
1641
1643
                        if result is self.uninteresting:
1642
1644
                            result = None
1643
 
                elif (current_entry[0][1] != current_path_info[1]
1644
 
                      or current_entry[1][self.target_index][0] in 'ar'):
1645
 
                    # The current path on disk doesn't match the dirblock
1646
 
                    # record. Either the dirblock is marked as absent, or
1647
 
                    # the file on disk is not present at all in the
1648
 
                    # dirblock. Either way, report about the dirblock
1649
 
                    # entry, and let other code handle the filesystem one.
 
1645
                else:
 
1646
                    minikind = _minikind_from_string(
 
1647
                        current_entry[1][self.target_index][0])
 
1648
                    cmp_result = cmp(current_path_info[1], current_entry[0][1])
 
1649
                    if (cmp_result or minikind == c'a' or minikind == c'r'):
 
1650
                        # The current path on disk doesn't match the dirblock
 
1651
                        # record. Either the dirblock record is marked as
 
1652
                        # absent/renamed, or the file on disk is not present at all
 
1653
                        # in the dirblock. Either way, report about the dirblock
 
1654
                        # entry, and let other code handle the filesystem one.
1650
1655
 
1651
 
                    # Compare the basename for these files to determine
1652
 
                    # which comes first
1653
 
                    if current_path_info[1] < current_entry[0][1]:
1654
 
                        # extra file on disk: pass for now, but only
1655
 
                        # increment the path, not the entry
1656
 
                        advance_entry = 0
 
1656
                        # Compare the basename for these files to determine
 
1657
                        # which comes first
 
1658
                        if cmp_result < 0:
 
1659
                            # extra file on disk: pass for now, but only
 
1660
                            # increment the path, not the entry
 
1661
                            advance_entry = 0
 
1662
                        else:
 
1663
                            # entry referring to file not present on disk.
 
1664
                            # advance the entry only, after processing.
 
1665
                            result = self._process_entry(current_entry, None)
 
1666
                            if result is not None:
 
1667
                                if result is self.uninteresting:
 
1668
                                    result = None
 
1669
                            advance_path = 0
1657
1670
                    else:
1658
 
                        # entry referring to file not present on disk.
1659
 
                        # advance the entry only, after processing.
1660
 
                        result = self._process_entry(current_entry, None)
 
1671
                        # paths are the same,and the dirstate entry is not
 
1672
                        # absent or renamed.
 
1673
                        result = self._process_entry(current_entry, current_path_info)
1661
1674
                        if result is not None:
 
1675
                            path_handled = -1
1662
1676
                            if result is self.uninteresting:
1663
1677
                                result = None
1664
 
                        advance_path = 0
1665
 
                else:
1666
 
                    result = self._process_entry(current_entry, current_path_info)
1667
 
                    if result is not None:
1668
 
                        path_handled = -1
1669
 
                        if result is self.uninteresting:
1670
 
                            result = None
1671
1678
                # >- loop control starts here:
1672
1679
                # >- entry
1673
1680
                if advance_entry and current_entry is not None: