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

Cope with removed files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""An adapter between a Git index and a Bazaar Working Tree"""
19
19
 
20
20
 
 
21
from cStringIO import (
 
22
    StringIO,
 
23
    )
21
24
from dulwich.index import (
22
25
    Index,
23
26
    )
130
133
                continue
131
134
            if entry.kind == "file":
132
135
                blob = Blob()
133
 
                file, stat_val = self.get_file_with_stat(entry.file_id, path)
 
136
                try:
 
137
                    file, stat_val = self.get_file_with_stat(entry.file_id, path)
 
138
                except (errors.NoSuchFile, IOError):
 
139
                    # TODO: Rather than come up with something here, use the old index
 
140
                    file = StringIO()
 
141
                    stat_val = (0, 0, 0, 0, stat.S_IFREG | 0644, 0, 0, 0, 0, 0)
134
142
                blob._text = file.read()
135
143
            elif entry.kind == "symlink":
136
144
                blob = Blob()
142
150
            # Add an entry to the index or update the existing entry
143
151
            (mode, ino, dev, links, uid, gid, size, atime, mtime, ctime) = stat_val
144
152
            flags = 0
145
 
            self.index[path] = (ctime, mtime, ino, dev, mode, uid, gid, size, blob.id, flags)
 
153
            self.index[path.encode("utf-8")] = (ctime, mtime, ino, dev, mode, uid, gid, size, blob.id, flags)
146
154
 
147
155
    def flush(self):
148
156
        # TODO: Maybe this should only write on dirty ?
149
157
        if self._control_files._lock_mode != 'w':
150
158
            raise errors.NotWriteLocked(self)
151
159
        self._rewrite_index()           
 
160
        self.index.write()
152
161
        self._inventory_is_modified = False
153
162
 
154
163
    def _reset_data(self):