MCPcopy Index your code
hub / github.com/Persper/code-analytics / CallCommitGraph

Class CallCommitGraph

persper/graphs/call_commit_graph.py:65–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64
65class CallCommitGraph(Processor):
66
67 def __init__(self, repo_path, lang='c'):
68 super().__init__(repo_path)
69 self.G = None
70 self.lang = lang
71 if lang == 'c':
72 self.exts = ('.c', '.h')
73 elif lang == 'java':
74 self.exts = ('.java',)
75 else:
76 print("Invalid language option, terminated.")
77 sys.exit(-1)
78 self.env = {}
79 self.history = {}
80 self.share = {}
81 self.patch_parser = PatchParser()
82
83 def _reset_state(self):
84 super()._reset_state()
85 self.G = nx.DiGraph()
86 self.history = {}
87
88 def _start_process_commit(self, commit):
89 self.history[commit.hexsha] = {}
90 if self.lang == 'java':
91 new_roots = []
92 diff_index = _diff_with_first_parent(commit)
93 _fill_change_type(diff_index)
94 for diff in diff_index:
95 if diff.change_type in ['A', 'M']:
96 fname = diff.b_blob.path
97 elif diff.change_type == 'R':
98 fname = diff.rename_to
99 else:
100 continue
101
102 if self.fname_filter(fname):
103 root = self._get_xml_root(commit, fname)
104 prepare_env(root, env=self.env)
105
106 def on_add(self, diff, commit, is_merge_commit):
107 old_fname = None
108 new_fname = diff.b_blob.path
109 return self._first_phase(diff, commit,
110 is_merge_commit,
111 old_fname=old_fname,
112 new_fname=new_fname)
113
114 def on_delete(self, diff, commit, is_merge_commit):
115 old_fname = diff.a_blob.path
116 new_fname = None
117 return self._first_phase(diff, commit,
118 is_merge_commit,
119 old_fname=old_fname,
120 new_fname=new_fname)
121
122 def on_rename(self, diff, commit, is_merge_commit):

Callers 5

mainFunction · 0.90
gFunction · 0.90
test_process_interfaceFunction · 0.90
createCclsGraphServerFunction · 0.90
test_call_commit_graphFunction · 0.90

Calls

no outgoing calls

Tested by 4

gFunction · 0.72
test_process_interfaceFunction · 0.72
createCclsGraphServerFunction · 0.72
test_call_commit_graphFunction · 0.72