From e4f8ba483b62bb2c4bf4bd42667b6fa0ae0dffc5 Mon Sep 17 00:00:00 2001 From: Li Yu Date: Fri, 14 Jul 2023 13:51:57 -0400 Subject: [PATCH] add indiviaul file changes to the changed file list; remove method not in use --- dbclient/common/WorkspaceDiff.py | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/dbclient/common/WorkspaceDiff.py b/dbclient/common/WorkspaceDiff.py index d16856f..ecde5d2 100644 --- a/dbclient/common/WorkspaceDiff.py +++ b/dbclient/common/WorkspaceDiff.py @@ -27,6 +27,8 @@ def get_updated_new_files(dir1: str, dir2: str): if os.path.isdir(objpath): new_files = get_dir_files(objpath) changed_files += new_files + else: + changed_files.append(objpath) for obj in dcmp.common_dirs: tmp_files = get_updated_new_files(os.path.join(dir1, obj), os.path.join(dir2, obj)) changed_files += tmp_files @@ -34,28 +36,6 @@ def get_updated_new_files(dir1: str, dir2: str): return set(changed_files) -def log_updated_new_files(dir1: str, dir2: str, logfile): - """ - Compare old artifacts directory and current artifacts directory - and log all noteboooks that have been updated or newly added to the notebook_changes.log file. - :param dir1: old artifacts directory - :param dir2: new artifacts directory - :param logfile: file pointer of the notebook_changes.log - """ - dcmp = dircmp(dir1, dir2) - for file in dcmp.diff_files: - logfile.write(os.path.join(dir2, file) + "\n") - for obj in dcmp.right_only: - objpath = os.path.join(dir2, obj) - if os.path.isdir(objpath): - new_files = get_dir_files(objpath) - logfile.writelines(new_files) - - for obj in dcmp.common_dirs: - log_updated_new_files(os.path.join(dir1, obj), os.path.join(dir2, obj), logfile) - - return None - def log_file_changes(changes_since_last: Set[str], log_file): """ Log the set of file names to a log file.