/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 tree.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-05 18:26:04 UTC
  • mfrom: (0.200.1933 work)
  • mto: (0.200.1934 work)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180505182604-rf3zyekbhwhlwddi
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
507
507
 
508
508
    def get_reference_revision(self, path, file_id=None):
509
509
        """See RevisionTree.get_symlink_target."""
510
 
        (mode, hexsha) = self._lookup_path(path)
 
510
        (store, mode, hexsha) = self._lookup_path(path)
511
511
        if S_ISGITLINK(mode):
512
512
            return self._repository.lookup_foreign_revision_id(hexsha)
513
513
        else:
787
787
        self._lock_mode = None
788
788
        self._lock_count = 0
789
789
        self._versioned_dirs = None
 
790
        self._index_dirty = False
790
791
 
791
792
    def is_versioned(self, path):
792
793
        with self.lock_read():
870
871
        # TODO(jelmer): Look in other indexes
871
872
        return self.index, encoded_path
872
873
 
 
874
    def _index_del_entry(self, index, path):
 
875
        del index[path]
 
876
        # TODO(jelmer): Keep track of dirty per index
 
877
        self._index_dirty = True
 
878
 
873
879
    def _index_add_entry(self, path, kind, flags=0, reference_revision=None):
874
880
        if not isinstance(path, basestring):
875
881
            raise TypeError(path)
929
935
            return
930
936
        (index, index_path) = self._lookup_index(encoded_path)
931
937
        index[index_path] = index_entry_from_stat(stat_val, hexsha, flags)
 
938
        self._index_dirty = True
932
939
        if self._versioned_dirs is not None:
933
940
            self._ensure_versioned_dir(index_path)
934
941
 
1043
1050
        count = 0
1044
1051
        (index, subpath) = self._lookup_index(encoded_path)
1045
1052
        try:
1046
 
            del index[subpath]
 
1053
            self._index_del_entry(index, encoded_path)
1047
1054
        except KeyError:
1048
1055
            # A directory, perhaps?
1049
1056
            # TODO(jelmer): Deletes that involve submodules?
1050
1057
            for p in list(index):
1051
1058
                if p.startswith(subpath+b"/"):
1052
1059
                    count += 1
1053
 
                    del index[p]
 
1060
                    self._index_del_entry(index, p)
1054
1061
        else:
1055
1062
            count = 1
1056
1063
        self._versioned_dirs = None
1073
1080
            if old_path is not None:
1074
1081
                (index, old_subpath) = self._lookup_index(old_path.encode('utf-8'))
1075
1082
                if old_subpath in index:
1076
 
                    del index[old_subpath]
 
1083
                    self._index_del_entry(index, old_subpath)
1077
1084
                    self._versioned_dirs = None
1078
1085
            if new_path is not None and ie.kind != 'directory':
1079
1086
                self._index_add_entry(new_path, ie.kind)
1160
1167
            if kind != 'directory':
1161
1168
                (index, from_index_path) = self._lookup_index(from_path)
1162
1169
                try:
1163
 
                    del index[from_index_path]
 
1170
                    self._index_del_entry(index, from_path)
1164
1171
                except KeyError:
1165
1172
                    pass
1166
1173
                self._index_add_entry(to_rel, kind)
1169
1176
                for child_path, child_value in todo:
1170
1177
                    (child_to_index, child_to_index_path) = self._lookup_index(posixpath.join(to_path, posixpath.relpath(child_path, from_path)))
1171
1178
                    child_to_index[child_to_index_path] = child_value
 
1179
                    # TODO(jelmer): Mark individual index as dirty
 
1180
                    self._index_dirty = True
1172
1181
                    (child_from_index, child_from_index_path) = self._lookup_index(child_path)
1173
 
                    del child_from_index[child_from_index_path]
 
1182
                    self._index_del_entry(child_from_index, child_from_index_path)
1174
1183
 
1175
1184
            self._versioned_dirs = None
1176
1185
            self.flush()