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

Support deletion of directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
        content_summary):
72
72
        raise NotImplementedError(self.record_entry_contents)
73
73
 
74
 
    def record_delete(self, path, file_id):
 
74
    def record_delete(self, kind, path, file_id):
75
75
        assert type(path) == str
76
 
        self._override_fileids[path] = None
77
 
        self._blobs[path] = None
 
76
        if kind != 'directory':
 
77
            self._override_fileids[path] = None
 
78
            self._blobs[path] = None
78
79
        self._any_changes = True
79
80
 
80
81
    def record_iter_changes(self, workingtree, basis_revid, iter_changes):
97
98
             executable) in iter_changes:
98
99
            if kind[1] in ("directory",):
99
100
                if kind[0] in ("file", "symlink"):
100
 
                    self.record_delete(path[0].encode("utf-8"), file_id)
 
101
                    self.record_delete(kind[0], path[0].encode("utf-8"), file_id)
101
102
                if path[1] == "":
102
103
                    seen_root = True
103
104
                continue
104
105
            if path[1] is None:
105
 
                self.record_delete(path[0].encode("utf-8"), file_id)
 
106
                self.record_delete(kind[0], path[0].encode("utf-8"), file_id)
106
107
                continue
107
108
            if kind[1] == "file":
108
109
                mode = stat.S_IFREG
124
125
            if file_sha1 is None:
125
126
                # File no longer exists
126
127
                if path[0] is not None:
127
 
                    self.record_delete(path[0].encode("utf-8"), file_id)
 
128
                    self.record_delete(kind[0], path[0].encode("utf-8"), file_id)
128
129
                continue
129
130
            _, st = workingtree.get_file_with_stat(file_id, path[1])
130
131
            yield file_id, path[1], (file_sha1, st)