/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 processors/generic_processor.py

  • Committer: James Westby
  • Date: 2008-03-08 15:53:00 UTC
  • mto: (0.64.56 fastimport_trunk)
  • mto: This revision was merged to the branch mainline in revision 6631.
  • Revision ID: jw+debian@jameswestby.net-20080308155300-4mrzlgqs4bb4f26m
Make the rename handling more robust.

Stop using an inventory delta, and use the Inventory.rename method. We
also have to be sure that the directory we are renaming in to.

Start a testsuite for the processors, with just some rename tests for now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
571
571
    def pre_process_files(self):
572
572
        """Prepare for committing."""
573
573
        self.revision_id = self.gen_revision_id()
574
 
        self.inv_delta = []
575
574
        # cache of texts for this commit, indexed by file-id
576
575
        self.lines_for_commit = {}
577
576
 
604
603
 
605
604
    def post_process_files(self):
606
605
        """Save the revision."""
607
 
        self.inventory.apply_delta(self.inv_delta)
608
606
        self.cache_mgr.inventories[self.revision_id] = self.inventory
609
607
 
610
608
        # Load the revision into the repository
671
669
        old_path = filecmd.old_path
672
670
        new_path = filecmd.new_path
673
671
        file_id = self.bzr_file_id(old_path)
674
 
        ie = self.inventory[file_id]
675
 
        self.inv_delta.append((old_path, new_path, file_id, ie))
 
672
        basename, new_parent_ie = self._ensure_directory(new_path)
 
673
        new_parent_id = new_parent_ie.file_id
 
674
        self.inventory.rename(file_id, new_parent_id, basename)
676
675
        self.cache_mgr._rename_path(old_path, new_path)
677
676
 
678
677
    def deleteall_handler(self, filecmd):