1. Added test_increment.py

2. Modify prompt in design_api_an.py
3. Modify rename_root function using method of copy in git_repository.py
This commit is contained in:
mannaandpoem 2024-01-03 18:10:53 +08:00
parent 4a498a9068
commit 994cfe814b
3 changed files with 168 additions and 5 deletions

View file

@ -190,7 +190,7 @@ class GitRepository:
return self._dependency
def rename_root(self, new_dir_name):
"""Rename the root directory of the Git repository.
"""Rename/Copy the root directory of the Git repository.
:param new_dir_name: The new name for the root directory.
"""
@ -201,10 +201,15 @@ class GitRepository:
logger.info(f"Delete directory {str(new_path)}")
shutil.rmtree(new_path)
try:
shutil.move(src=str(self.workdir), dst=str(new_path))
shutil.copytree(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"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)}")
self._repository = Repo(new_path)
self._gitignore_rules = parse_gitignore(full_path=str(new_path / ".gitignore"))