~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mutabletree.py

  • Committer: Aaron Bentley
  • Date: 2009-03-13 08:19:06 UTC
  • mto: This revision was merged to the branch mainline in revision 4196.
  • Revision ID: aaron@aaronbentley.com-20090313081906-168g1ihto9jmenjf
Get directory rename handling working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
244
244
        versioned files have been renamed outside of Bazaar.
245
245
        """
246
246
        missing_files = set()
247
 
        missing_parents = set()
 
247
        missing_parents = {}
248
248
        candidate_files = set()
249
249
        basis = self.basis_tree()
250
250
        basis.lock_read()
253
253
            for (file_id, paths, changed_content, versioned, parent, name,
254
254
                 kind, executable) in iterator:
255
255
                if kind[1] is None and versioned[1]:
256
 
                    missing_parents.add(parent[1])
 
256
                    missing_parents.setdefault(parent[0], set()).add(file_id)
257
257
                    if kind[0] == 'file':
258
258
                        missing_files.add(file_id)
259
259
                    else:
277
277
                rn.add_file_edge_hashes(basis, missing_files)
278
278
                pp.next_phase()
279
279
                matches = rn.file_match(self, candidate_files)
 
280
                required_parents = rn.get_required_parents(matches, self)
 
281
                matches.update(rn.match_parents(required_parents,
 
282
                               missing_parents))
280
283
            finally:
281
284
                task.finished()
282
 
            self.add(rn.get_required_parents(matches, self))
283
 
            self.unversion(matches.values())
284
 
            self.add(matches.keys(), matches.values())
 
285
            self.add(set(required_parents) - set(matches))
 
286
            reversed = dict((v, k) for k, v in matches.iteritems())
 
287
            child_to_parent = sorted(
 
288
                matches.values(), key=lambda x: reversed[x], reverse=True)
 
289
            self.unversion(child_to_parent)
 
290
            paths_forward = sorted(matches.keys())
 
291
            file_ids_forward = [matches[p] for p in paths_forward]
 
292
            self.add(paths_forward, file_ids_forward)
285
293
        finally:
286
294
            basis.unlock()
287
295