MCPcopy Create free account
hub / github.com/Persper/code-analytics / update_graph

Method update_graph

persper/analytics/c.py:51–75  ·  view source on GitHub ↗
(self, old_filename, old_src, new_filename, new_src, patch)

Source from the content-addressed store, hash-verified

49 commit_message)
50
51 def update_graph(self, old_filename, old_src, new_filename, new_src, patch):
52 ast_list = []
53 old_ast = None
54 new_ast = None
55
56 # Parse source codes into ASTs
57 if old_src:
58 old_ast = transform_src_to_tree(old_src)
59 if old_ast is None:
60 return -1
61
62 if new_src:
63 new_ast = transform_src_to_tree(new_src)
64 if new_ast is None:
65 return -1
66 ast_list = [new_ast]
67
68 # Compute function change stats
69 change_stats = function_change_stats(old_ast, new_ast, patch,
70 self._parse_patch,
71 get_func_ranges_c)
72
73 # Update call-commit graph
74 update_graph(self._ccgraph, ast_list, change_stats)
75 return 0
76
77 def get_graph(self):
78 return self._ccgraph

Callers 1

_analyzeCommitMethod · 0.45

Calls 3

transform_src_to_treeFunction · 0.90
update_graphFunction · 0.90
function_change_statsFunction · 0.85

Tested by

no test coverage detected