534
534
if len(names_list) < 2:
535
535
raise errors.BzrCommandError("missing file argument")
536
536
tree, rel_names = tree_files(names_list)
539
self._run(tree, names_list, rel_names, after)
538
dest = names_list[-1]
539
isdir = os.path.isdir(dest)
540
if (isdir and not tree.case_sensitive and len(rel_names) == 2
541
and rel_names[0].lower() == rel_names[1].lower()):
543
def _run(self, tree, names_list, rel_names, after):
544
into_existing = osutils.isdir(names_list[-1])
545
if into_existing and len(names_list) == 2:
547
# a. case-insensitive filesystem and change case of dir
548
# b. move directory after the fact (if the source used to be
549
# a directory, but now doesn't exist in the working tree
550
# and the target is an existing directory, just rename it)
551
if (not tree.case_sensitive
552
and rel_names[0].lower() == rel_names[1].lower()):
553
into_existing = False
556
from_id = tree.path2id(rel_names[0])
557
if (not osutils.lexists(names_list[0]) and
558
from_id and inv.get_file_kind(from_id) == "directory"):
559
into_existing = False
544
562
# move into existing directory
545
563
for pair in tree.move(rel_names[:-1], rel_names[-1], after=after):
546
564
self.outf.write("%s => %s\n" % pair)