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

  • Committer: Ian Clatworthy
  • Date: 2009-08-21 15:34:14 UTC
  • mto: (0.64.225 trunk)
  • mto: This revision was merged to the branch mainline in revision 6631.
  • Revision ID: ian.clatworthy@canonical.com-20090821153414-2h1hkz3oi257mz3o
Eliminate the existing file-id cache altogether

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
        except KeyError:
136
136
            return self._blobs.pop(id)
137
137
 
138
 
    def store_file_id(self, branch_ref, path, id):
139
 
        """Store the path to file-id mapping for a branch."""
140
 
        key = self._fileid_key(path, branch_ref)
141
 
        self._file_ids[key] = id
142
 
 
143
 
    def fetch_file_id(self, branch_ref, path):
144
 
        """Lookup the file-id for a path in a branch.
145
 
        
146
 
        Raises KeyError if unsuccessful.
147
 
        """
148
 
        key = self._fileid_key(path, branch_ref)
149
 
        return self._file_ids[key]
150
 
 
151
 
    def _fileid_key(self, path, branch_ref):
152
 
        return (path, branch_ref)
153
 
 
154
 
    def delete_path(self, branch_ref, path):
155
 
        """Remove a path from caches."""
156
 
        # We actually want to remember what file-id we gave a path,
157
 
        # even when that file is deleted, so doing nothing is correct.
158
 
        # It's quite possible for a path to be deleted twice where
159
 
        # the first time is in a merge branch (but the same branch_ref)
160
 
        # and the second time is when that branch is merged to mainline.
161
 
        pass
162
 
 
163
 
    def rename_path(self, branch_ref, old_path, new_path):
164
 
        """Rename a path in the caches."""
165
 
        # In this case, we need to forget the file-id we gave a path,
166
 
        # otherwise, we'll get duplicate file-ids in the repository
167
 
        # if a new file is created at the old path.
168
 
        old_key = self._fileid_key(old_path, branch_ref)
169
 
        new_key = self._fileid_key(new_path, branch_ref)
170
 
        try:
171
 
            old_file_id = self._file_ids[old_key]
172
 
        except KeyError:
173
 
            # The old_key has already been removed, most likely
174
 
            # in a merge branch.
175
 
            pass
176
 
        else:
177
 
            self._file_ids[new_key] = old_file_id
178
 
            del self._file_ids[old_key]
179
 
 
180
138
    def track_heads(self, cmd):
181
139
        """Track the repository heads given a CommitCommand.
182
140