@@ -253,7 +253,7 @@ def build_commit_graph(path: str, analyzer: SourceAnalyzer, repo_name: str, igno
253253
254254 return git_graph
255255
256- def switch_commit (repo : str , to : str ) -> dict [ str , dict [ str , list ]] :
256+ def switch_commit (repo : str , to : str ):
257257 """
258258 Switches the state of a graph repository from its current commit to the given commit.
259259
@@ -264,21 +264,6 @@ def switch_commit(repo: str, to: str) -> dict[str, dict[str, list]]:
264264 Args:
265265 repo (str): The name of the graph repository to switch commits.
266266 to (str): The target commit hash to switch the graph to.
267-
268- Returns:
269- dict: A dictionary containing the changes made during the commit switch, organized by:
270- - 'deletions': {
271- 'nodes': List of node IDs deleted,
272- 'edges': List of edge IDs deleted
273- },
274- - 'additions': {
275- 'nodes': List of new Node objects added,
276- 'edges': List of new Edge objects added
277- },
278- - 'modifications': {
279- 'nodes': List of modified Node objects,
280- 'edges': List of modified Edge objects
281- }
282267 """
283268
284269 # Validate input arguments
@@ -290,22 +275,6 @@ def switch_commit(repo: str, to: str) -> dict[str, dict[str, list]]:
290275
291276 logging .info (f"Switching to commit: { to } " )
292277
293- # Initialize return value to an empty change set
294- change_set = {
295- 'deletions' : {
296- 'nodes' : [],
297- 'edges' : []
298- },
299- 'additions' : {
300- 'nodes' : [],
301- 'edges' : [],
302- },
303- 'modifications' : {
304- 'nodes' : [],
305- 'edges' : []
306- }
307- }
308-
309278 # Initialize the graph and GitGraph objects
310279 g = Graph (repo )
311280 git_graph = GitGraph (GitRepoName (repo ))
@@ -317,7 +286,7 @@ def switch_commit(repo: str, to: str) -> dict[str, dict[str, list]]:
317286 if current_hash == to :
318287 logging .debug ("Current commit: {current_hash} is the requested commit" )
319288 # No change remain at the current commit
320- return change_set
289+ return
321290
322291 # Find the path between the current commit and the desired commit
323292 commits = git_graph .get_commits ([current_hash , to ])
@@ -353,14 +322,8 @@ def switch_commit(repo: str, to: str) -> dict[str, dict[str, list]]:
353322 logging .debug (f"Executing query: { _q } with params: { _p } " )
354323
355324 # Rerun the query with parameters on the graph
356- res = g .rerun_query (_q , _p )
357- if "DELETE" in _q :
358- deleted_nodes = res .result_set [0 ][0 ]
359- change_set ['deletions' ]['nodes' ] += deleted_nodes
325+ g .rerun_query (_q , _p )
360326
361327 # Update the graph's commit to the new target commit
362328 set_repo_commit (repo , to )
363329 logging .info (f"Graph commit updated to { to } " )
364-
365- return change_set
366-
0 commit comments