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

Class Processor

persper/graphs/processor.py:45–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43
44
45class Processor():
46
47 def __init__(self, repo_path):
48 self.repo_path = repo_path
49 self.repo = initialize_repo(repo_path)
50 self.visited = set()
51 self.last_processed_commit = None
52
53 def process(self, rev=None,
54 from_beginning=False, num_commits=None,
55 from_last_processed=False, end_commit_sha=None,
56 into_branches=False,
57 max_branch_length=100,
58 min_branch_date=None,
59 checkpoint_interval=100,
60 skip_work=False,
61 verbose=True):
62 """
63 This function supports four ways of specifying the
64 range of commits to process:
65
66 Method 1: rev
67 Pass `rev` parameter and set both
68 `from_beginning` and `from_last_processed` to False.
69 `rev` is the revision specifier which follows
70 an extended SHA-1 syntax. Please refer to git-rev-parse
71 for viable options. `rev' should only include commits
72 on the master branch.
73
74 Method 2: from_beginning & num_commits (optional)
75 Set `from_beginning` to True and
76 pass `num_commits` parameter. Using this
77 method, the function will start from the
78 very first commit on the master branch and
79 process the following `num_commits` commits
80 (also on the master branch).
81
82 Method 3: from_last_processed & num_commits
83 Set `from_last_processed` to True and pass
84 `num_commits` parameter. Using this method, the
85 function will resume processing from succeeding commit of
86 `self.last_processed_commit` for `num_commits` commits.
87
88 Method 4: from_last_processed & end_commit_sha
89 Set `from_last_processed` to True and pass
90 `end_commit_sha` parameter. The range of continued processing
91 will be `self.last_processed_commit.hexsha..end_commit_sha`.
92
93 Args:
94 rev: A string, see above.
95 num_commits: An int, see above.
96 from_beginning: A boolean flag, see above.
97 from_last_processed: A boolean flag, see above.
98 end_commit_sha: A string, see above.
99 into_branches: A boolean flag, if True, the process function
100 will operate in two phases.
101
102 In the first phase, a call commit graph is contructed

Callers 1

test_processorFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_processorFunction · 0.72