@@ -82,27 +82,29 @@ def test_get_pull_action_valid():
8282 with tempfile .TemporaryDirectory () as tmp_dir :
8383 mp = MerginProject (tmp_dir )
8484
85- # Test cases: (server_change, local_change, expected_action)
85+ # Test cases: (server_change, local_change, server_checksum, local_checksum, expected_action)
8686 test_cases = [
87- (DeltaChangeType .CREATE , None , PullActionType .COPY ),
88- (DeltaChangeType .CREATE , DeltaChangeType .CREATE , PullActionType .COPY_CONFLICT ),
89- (DeltaChangeType .UPDATE , None , PullActionType .COPY ),
90- (DeltaChangeType .UPDATE , DeltaChangeType .UPDATE , PullActionType .COPY_CONFLICT ),
91- (DeltaChangeType .UPDATE , DeltaChangeType .DELETE , PullActionType .COPY ),
92- (DeltaChangeType .UPDATE , DeltaChangeType .UPDATE_DIFF , PullActionType .COPY_CONFLICT ),
93- (DeltaChangeType .UPDATE , DeltaChangeType .CREATE , PullActionType .COPY_CONFLICT ),
94- (DeltaChangeType .UPDATE_DIFF , None , PullActionType .APPLY_DIFF_NO_REBASE ),
95- (DeltaChangeType .UPDATE_DIFF , DeltaChangeType .UPDATE , PullActionType .COPY_CONFLICT ),
96- (DeltaChangeType .UPDATE_DIFF , DeltaChangeType .DELETE , PullActionType .COPY ),
97- (DeltaChangeType .UPDATE_DIFF , DeltaChangeType .UPDATE_DIFF , PullActionType .APPLY_DIFF_REBASE ),
98- (DeltaChangeType .DELETE , None , PullActionType .DELETE ),
99- (DeltaChangeType .DELETE , DeltaChangeType .UPDATE , None ),
100- (DeltaChangeType .DELETE , DeltaChangeType .DELETE , None ),
101- (DeltaChangeType .DELETE , DeltaChangeType .UPDATE_DIFF , None ),
87+ (DeltaChangeType .CREATE , None , None , None , PullActionType .COPY ),
88+ (DeltaChangeType .CREATE , DeltaChangeType .CREATE , "c1" , "c2" , PullActionType .COPY_CONFLICT ),
89+ (DeltaChangeType .CREATE , DeltaChangeType .CREATE , "c1" , "c1" , None ),
90+ (DeltaChangeType .UPDATE , None , None , None , PullActionType .COPY ),
91+ (DeltaChangeType .UPDATE , DeltaChangeType .UPDATE , "c1" , "c2" , PullActionType .COPY_CONFLICT ),
92+ (DeltaChangeType .UPDATE , DeltaChangeType .UPDATE , "c1" , "c1" , None ),
93+ (DeltaChangeType .UPDATE , DeltaChangeType .DELETE , "c1" , "c2" , PullActionType .COPY ),
94+ (DeltaChangeType .UPDATE , DeltaChangeType .UPDATE_DIFF , "c1" , "c2" , PullActionType .COPY_CONFLICT ),
95+ (DeltaChangeType .UPDATE , DeltaChangeType .CREATE , "c1" , "c2" , PullActionType .COPY_CONFLICT ),
96+ (DeltaChangeType .UPDATE_DIFF , None , "c1" , "c2" , PullActionType .APPLY_DIFF_NO_REBASE ),
97+ (DeltaChangeType .UPDATE_DIFF , DeltaChangeType .UPDATE , "c1" , "c2" , PullActionType .COPY_CONFLICT ),
98+ (DeltaChangeType .UPDATE_DIFF , DeltaChangeType .DELETE , "c1" , "c2" , PullActionType .COPY ),
99+ (DeltaChangeType .UPDATE_DIFF , DeltaChangeType .UPDATE_DIFF , "c1" , "c2" , PullActionType .APPLY_DIFF_REBASE ),
100+ (DeltaChangeType .DELETE , None , "c1" , "c2" , PullActionType .DELETE ),
101+ (DeltaChangeType .DELETE , DeltaChangeType .UPDATE , None , None , None ),
102+ (DeltaChangeType .DELETE , DeltaChangeType .DELETE , None , None , None ),
103+ (DeltaChangeType .DELETE , DeltaChangeType .UPDATE_DIFF , None , None , None ),
102104 ]
103105
104- for server_change , local_change , expected_action in test_cases :
105- action = mp .get_pull_action (server_change , local_change )
106+ for server_change , local_change , server_checksum , local_checksum , expected_action in test_cases :
107+ action = mp .get_pull_action (server_change , local_change , server_checksum , local_checksum )
106108 assert (
107109 action == expected_action
108110 ), f"Failed for { server_change } , { local_change } . Expected { expected_action } , got { action } "
@@ -123,7 +125,7 @@ def test_get_pull_action_fatal():
123125
124126 for server_change , local_change in fatal_cases :
125127 with pytest .raises (ClientError , match = "Invalid combination of changes" ):
126- mp .get_pull_action (server_change , local_change )
128+ mp .get_pull_action (server_change , local_change , None , None )
127129
128130
129131def test_get_pull_delta ():
0 commit comments