705
def rename_one(self, from_rel, to_rel):
706
tree = self.working_tree()
708
if not tree.has_filename(from_rel):
709
bailout("can't rename: old working file %r does not exist" % from_rel)
710
if tree.has_filename(to_rel):
711
bailout("can't rename: new working file %r already exists" % to_rel)
713
file_id = inv.path2id(from_rel)
715
bailout("can't rename: old name %r is not versioned" % from_rel)
717
if inv.path2id(to_rel):
718
bailout("can't rename: new name %r is already versioned" % to_rel)
720
to_dir, to_tail = os.path.split(to_rel)
721
to_dir_id = inv.path2id(to_dir)
722
if to_dir_id == None and to_dir != '':
723
bailout("can't determine destination directory id for %r" % to_dir)
725
mutter("rename_one:")
726
mutter(" file_id {%s}" % file_id)
727
mutter(" from_rel %r" % from_rel)
728
mutter(" to_rel %r" % to_rel)
729
mutter(" to_dir %r" % to_dir)
730
mutter(" to_dir_id {%s}" % to_dir_id)
732
inv.rename(file_id, to_dir_id, to_tail)
733
os.rename(self.abspath(from_rel), self.abspath(to_rel))
735
self._write_inventory(inv)
706
739
def rename(self, from_paths, to_name):