File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -1167,13 +1167,15 @@ def __init__(
1167
1167
url : str ,
1168
1168
query_data : Dict [str , Any ],
1169
1169
get_next : bool = True ,
1170
+ dedupe : bool = True ,
1170
1171
** kwargs : Any ,
1171
1172
) -> None :
1172
1173
self ._gl = gl
1173
1174
1174
1175
# Preserve kwargs for subsequent queries
1175
1176
self ._kwargs = kwargs .copy ()
1176
1177
1178
+ self ._dedupe = dedupe
1177
1179
self ._retrieved_object_ids : set [int ] = set ()
1178
1180
1179
1181
self ._query (url , query_data , ** self ._kwargs )
@@ -1207,17 +1209,20 @@ def _query(
1207
1209
error_message = "Failed to parse the server message"
1208
1210
) from e
1209
1211
1210
- duplicate_ids = set (o ["id" ] for o in self ._data ) & self ._retrieved_object_ids
1211
- if duplicate_ids :
1212
- utils .warn (
1213
- message = (
1214
- f"During pagination duplicate object(s) with id(s) "
1215
- f"{ duplicate_ids } returned from Gitlab and filtered"
1216
- ),
1217
- category = UserWarning ,
1212
+ if self ._dedupe :
1213
+ duplicate_ids = (
1214
+ set (o ["id" ] for o in self ._data ) & self ._retrieved_object_ids
1218
1215
)
1219
- self ._data = [o for o in self ._data if o ["id" ] not in duplicate_ids ]
1220
- self ._retrieved_object_ids .update (o ["id" ] for o in self ._data )
1216
+ if duplicate_ids :
1217
+ utils .warn (
1218
+ message = (
1219
+ f"During pagination duplicate object(s) with id(s) "
1220
+ f"{ duplicate_ids } returned from Gitlab and filtered"
1221
+ ),
1222
+ category = UserWarning ,
1223
+ )
1224
+ self ._data = [o for o in self ._data if o ["id" ] not in duplicate_ids ]
1225
+ self ._retrieved_object_ids .update (o ["id" ] for o in self ._data )
1221
1226
1222
1227
self ._current = 0
1223
1228
You can’t perform that action at this time.
0 commit comments