/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_pyx.pyx

  • Committer: John Arbash Meinel
  • Date: 2009-08-04 14:10:09 UTC
  • mfrom: (4585 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4588.
  • Revision ID: john@arbash-meinel.com-20090804141009-uety2n17v1atk5ok
Merge bzr.dev 4585, resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
965
965
 
966
966
    cdef object old_dirname_to_file_id # dict
967
967
    cdef object new_dirname_to_file_id # dict
968
 
    cdef readonly object uninteresting
969
968
    cdef object last_source_parent
970
969
    cdef object last_target_parent
971
970
    cdef object include_unchanged
1002
1001
        want_unversioned, tree):
1003
1002
        self.old_dirname_to_file_id = {}
1004
1003
        self.new_dirname_to_file_id = {}
1005
 
        # Just a sentry, so that _process_entry can say that this
1006
 
        # record is handled, but isn't interesting to process (unchanged)
1007
 
        self.uninteresting = object()
1008
1004
        # Using a list so that we can access the values and change them in
1009
1005
        # nested scope. Each one is [path, file_id, entry]
1010
1006
        self.last_source_parent = [None, None]
1055
1051
            Basename is returned as a utf8 string because we expect this
1056
1052
            tuple will be ignored, and don't want to take the time to
1057
1053
            decode.
1058
 
        :return: None if the these don't match
1059
 
                 A tuple of information about the change, or
1060
 
                 the object 'uninteresting' if these match, but are
1061
 
                 basically identical.
 
1054
        :return: (iter_changes_result, changed). If the entry has not been
 
1055
            handled then changed is None. Otherwise it is False if no content
 
1056
            or metadata changes have occured, and None if any content or
 
1057
            metadata change has occured. If self.include_unchanged is True then
 
1058
            if changed is not None, iter_changes_result will always be a result
 
1059
            tuple. Otherwise, iter_changes_result is None unless changed is
 
1060
            True.
1062
1061
        """
1063
1062
        cdef char target_minikind
1064
1063
        cdef char source_minikind
1220
1219
                    self.last_target_parent[1] = target_parent_id
1221
1220
 
1222
1221
            source_exec = source_details[3]
1223
 
            if (self.include_unchanged
1224
 
                or content_change
 
1222
            changed = (content_change
1225
1223
                or source_parent_id != target_parent_id
1226
1224
                or old_basename != entry[0][1]
1227
1225
                or source_exec != target_exec
1228
 
                ):
 
1226
                )
 
1227
            if not changed and not self.include_unchanged:
 
1228
                return None, False
 
1229
            else:
1229
1230
                if old_path is None:
1230
1231
                    path = self.pathjoin(old_dirname, old_basename)
1231
1232
                    old_path = path
1245
1246
                       (source_parent_id, target_parent_id),
1246
1247
                       (self.utf8_decode(old_basename)[0], self.utf8_decode(entry[0][1])[0]),
1247
1248
                       (source_kind, target_kind),
1248
 
                       (source_exec, target_exec))
1249
 
            else:
1250
 
                return self.uninteresting
 
1249
                       (source_exec, target_exec)), changed
1251
1250
        elif source_minikind == c'a' and _versioned_minikind(target_minikind):
1252
1251
            # looks like a new file
1253
1252
            path = self.pathjoin(entry[0][0], entry[0][1])
1280
1279
                       (None, parent_id),
1281
1280
                       (None, self.utf8_decode(entry[0][1])[0]),
1282
1281
                       (None, path_info[2]),
1283
 
                       (None, target_exec))
 
1282
                       (None, target_exec)), True
1284
1283
            else:
1285
1284
                # Its a missing file, report it as such.
1286
1285
                return (entry[0][2],
1290
1289
                       (None, parent_id),
1291
1290
                       (None, self.utf8_decode(entry[0][1])[0]),
1292
1291
                       (None, None),
1293
 
                       (None, False))
 
1292
                       (None, False)), True
1294
1293
        elif _versioned_minikind(source_minikind) and target_minikind == c'a':
1295
1294
            # unversioned, possibly, or possibly not deleted: we dont care.
1296
1295
            # if its still on disk, *and* theres no other entry at this
1308
1307
                   (parent_id, None),
1309
1308
                   (self.utf8_decode(entry[0][1])[0], None),
1310
1309
                   (_minikind_to_kind(source_minikind), None),
1311
 
                   (source_details[3], None))
 
1310
                   (source_details[3], None)), True
1312
1311
        elif _versioned_minikind(source_minikind) and target_minikind == c'r':
1313
1312
            # a rename; could be a true rename, or a rename inherited from
1314
1313
            # a renamed parent. TODO: handle this efficiently. Its not
1327
1326
                "source_minikind=%r, target_minikind=%r"
1328
1327
                % (source_minikind, target_minikind))
1329
1328
            ## import pdb;pdb.set_trace()
1330
 
        return None
 
1329
        return None, None
1331
1330
 
1332
1331
    def __iter__(self):
1333
1332
        return self
1401
1400
        cdef char * current_dirname_c, * current_blockname_c
1402
1401
        cdef int advance_entry, advance_path
1403
1402
        cdef int path_handled
1404
 
        uninteresting = self.uninteresting
1405
1403
        searched_specific_files = self.searched_specific_files
1406
1404
        # Are we walking a root?
1407
1405
        while self.root_entries_pos < self.root_entries_len:
1408
1406
            entry = self.root_entries[self.root_entries_pos]
1409
1407
            self.root_entries_pos = self.root_entries_pos + 1
1410
 
            result = self._process_entry(entry, self.root_dir_info)
1411
 
            if result is not None and result is not self.uninteresting:
 
1408
            result, changed = self._process_entry(entry, self.root_dir_info)
 
1409
            if changed is not None and changed or self.include_unchanged:
1412
1410
                return result
1413
1411
        # Have we finished the prior root, or never started one ?
1414
1412
        if self.current_root is None:
1457
1455
            while self.root_entries_pos < self.root_entries_len:
1458
1456
                entry = self.root_entries[self.root_entries_pos]
1459
1457
                self.root_entries_pos = self.root_entries_pos + 1
1460
 
                result = self._process_entry(entry, self.root_dir_info)
1461
 
                if result is not None:
 
1458
                result, changed = self._process_entry(entry, self.root_dir_info)
 
1459
                if changed is not None:
1462
1460
                    path_handled = -1
1463
 
                    if result is not self.uninteresting:
 
1461
                    if changed or self.include_unchanged:
1464
1462
                        return result
1465
1463
            # handle unversioned specified paths:
1466
1464
            if self.want_unversioned and not path_handled and self.root_dir_info:
1606
1604
                        self.current_block_pos = self.current_block_pos + 1
1607
1605
                        # entry referring to file not present on disk.
1608
1606
                        # advance the entry only, after processing.
1609
 
                        result = self._process_entry(current_entry, None)
1610
 
                        if result is not None:
1611
 
                            if result is not self.uninteresting:
 
1607
                        result, changed = self._process_entry(current_entry, None)
 
1608
                        if changed is not None:
 
1609
                            if changed or self.include_unchanged:
1612
1610
                                return result
1613
1611
                    self.block_index = self.block_index + 1
1614
1612
                    self._update_current_block()
1675
1673
                    pass
1676
1674
                elif current_path_info is None:
1677
1675
                    # no path is fine: the per entry code will handle it.
1678
 
                    result = self._process_entry(current_entry, current_path_info)
1679
 
                    if result is not None:
1680
 
                        if result is self.uninteresting:
1681
 
                            result = None
 
1676
                    result, changed = self._process_entry(current_entry,
 
1677
                        current_path_info)
1682
1678
                else:
1683
1679
                    minikind = _minikind_from_string(
1684
1680
                        current_entry[1][self.target_index][0])
1699
1695
                        else:
1700
1696
                            # entry referring to file not present on disk.
1701
1697
                            # advance the entry only, after processing.
1702
 
                            result = self._process_entry(current_entry, None)
1703
 
                            if result is not None:
1704
 
                                if result is self.uninteresting:
1705
 
                                    result = None
 
1698
                            result, changed = self._process_entry(current_entry,
 
1699
                                None)
1706
1700
                            advance_path = 0
1707
1701
                    else:
1708
1702
                        # paths are the same,and the dirstate entry is not
1709
1703
                        # absent or renamed.
1710
 
                        result = self._process_entry(current_entry, current_path_info)
1711
 
                        if result is not None:
 
1704
                        result, changed = self._process_entry(current_entry,
 
1705
                            current_path_info)
 
1706
                        if changed is not None:
1712
1707
                            path_handled = -1
1713
 
                            if result is self.uninteresting:
1714
 
                                result = None
1715
1708
                # >- loop control starts here:
1716
1709
                # >- entry
1717
1710
                if advance_entry and current_entry is not None: