From db0407e6a4356cf117d22f68d52c59fa271a4efc Mon Sep 17 00:00:00 2001 From: "Thorvald M. Ballestad" Date: Tue, 13 Aug 2024 11:16:11 +0200 Subject: [PATCH] rename change to deletion and addition --- src/dvc_data/index/diff.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dvc_data/index/diff.py b/src/dvc_data/index/diff.py index 7f8e3b19..32a32f3b 100644 --- a/src/dvc_data/index/diff.py +++ b/src/dvc_data/index/diff.py @@ -263,13 +263,13 @@ def _get_key(change): # Create a dictionary for fast lookup of deletions by hash_info deleted_dict: dict[Optional[HashInfo], deque[Change]] = defaultdict(deque) - for change in deleted: - change_hash = change.old.hash_info if change.old else None + for deletion in deleted: + change_hash = deletion.old.hash_info if deletion.old else None # appendleft to get queue behaviour (we pop off right) - deleted_dict[change_hash].appendleft(change) + deleted_dict[change_hash].appendleft(deletion) - for change in added: - new_hash_info = change.new.hash_info if change.new else None + for addition in added: + new_hash_info = addition.new.hash_info if addition.new else None # If the new entry is the same as a deleted change, # it is in fact a rename. @@ -281,10 +281,10 @@ def _get_key(change): yield Change( RENAME, deletion.old, - change.new, + addition.new, ) else: - yield change + yield addition # Yield the remaining unmatched deletions if deleted_dict: