668
668
old_path = filecmd.old_path
669
669
new_path = filecmd.new_path
670
670
self.debug("renaming %s to %s", old_path, new_path)
671
file_id = self.bzr_file_id(old_path)
672
basename, new_parent_ie = self._ensure_directory(new_path)
671
old_file_id = self.inventory.path2id(old_path)
672
old_ie = self.inventory[old_file_id]
673
new_file_id = self.inventory.path2id(new_path)
674
if new_file_id is not None:
675
self.inventory.remove_recursive_id(new_file_id)
677
# Why are these lines needed?
678
old_lines = self.loader._get_lines(old_file_id, old_ie.revision)
679
self.lines_for_commit[old_file_id] = old_lines
680
self.inventory[old_file_id].revision = self.revision_id
682
new_basename, new_parent_ie = self._ensure_directory(new_path)
673
683
new_parent_id = new_parent_ie.file_id
674
existing_id = self.inventory.path2id(new_path)
675
if existing_id is not None:
676
self.inventory.remove_recursive_id(existing_id)
677
ie = self.inventory[file_id]
678
lines = self.loader._get_lines(file_id, ie.revision)
679
self.lines_for_commit[file_id] = lines
680
self.inventory.rename(file_id, new_parent_id, basename)
684
self.inventory.rename(old_file_id, new_parent_id, new_basename)
681
685
self.cache_mgr.rename_path(old_path, new_path)
682
self.inventory[file_id].revision = self.revision_id
684
687
def deleteall_handler(self, filecmd):
685
688
self.debug("deleting all files (and also all directories)")