Update prompt and fix up some bug

This commit is contained in:
mannaandpoem 2024-01-04 10:41:36 +08:00
parent 0168c99323
commit e3cd1a2cc1
9 changed files with 35 additions and 60 deletions

View file

@ -189,7 +189,7 @@ class GitRepository:
return self._dependency
def rename_root(self, new_dir_name):
"""Rename/Copy the root directory of the Git repository.
"""Rename the root directory of the Git repository.
:param new_dir_name: The new name for the root directory.
"""
@ -200,15 +200,10 @@ class GitRepository:
logger.info(f"Delete directory {str(new_path)}")
shutil.rmtree(new_path)
try:
shutil.copytree(src=str(self.workdir), dst=str(new_path))
shutil.move(src=str(self.workdir), dst=str(new_path))
except Exception as e:
logger.warning(f"Copy {str(self.workdir)} to {str(new_path)} error: {e}")
logger.info(f"Copy directory {str(self.workdir)} to {str(new_path)}")
# try:
# shutil.move(src=str(self.workdir), dst=str(new_path))
# except Exception as e:
# logger.warning(f"Move {str(self.workdir)} to {str(new_path)} error: {e}")
# logger.info(f"Rename directory {str(self.workdir)} to {str(new_path)}")
logger.warning(f"Move {str(self.workdir)} to {str(new_path)} error: {e}")
logger.info(f"Rename directory {str(self.workdir)} to {str(new_path)}")
self._repository = Repo(new_path)
self._gitignore_rules = parse_gitignore(full_path=str(new_path / ".gitignore"))