Commit Loader
apiRequest(url, token)
Takes the URL for the request and token
Examples:
apiRequest("https://github.com/linkedin", "xxxxxxxx")
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
String
|
the url for the request |
required |
token |
String
|
GitHub API token |
required |
Return
response body of the request on json format
Source code in src/core/commitLoader.py
fileName(name)
fileName(name) Extract the file name used for storing the file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
String
|
the patch retrieved from the commit api for the file |
required |
Source code in src/core/commitLoader.py
findFile(filename, repo, token, sha)
findFile(filename, repo) Check if the file exists in the other repository
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
String
|
the file path to be checked for existence |
required |
repo |
String
|
the repository in which the existence of the file must be checked |
required |
token |
String
|
the token for the api request |
required |
sha |
String
|
the GitHub sha |
required |
Source code in src/core/commitLoader.py
getCommit(commit, getCommitToken)
Get the files for each commit
Parameters:
Name | Type | Description | Default |
---|---|---|---|
commit |
String
|
the commits for which files need to be retrieved |
required |
getCommitToken |
String
|
the token used for the qpi request to get the commit |
required |
commitFilesDict={ "sha": { "commitUrl": url "files": list(file 1, file 2, ... , file n) }
}
Source code in src/core/commitLoader.py
getCommitsAhead(mainline, fork, commitToken, compareToken)
Get the commits that the mainline is ahead of the variant
Examples:
getCommitsAhead(mainline, fork)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mainline |
String
|
the mainline author/repo |
required |
fork |
String
|
the fork author/repo |
required |
commitToken |
String
|
the token used for constructin the compareUrl |
required |
compareToken |
String
|
the token used for comparing mainline and fork |
required |
Return
List of commits a head
Source code in src/core/commitLoader.py
getPatch(file, storageDir, fileName)
get_patch(url, token) Send a request to the github api to find retrieve the patch of a commit and saves it to a .patch file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
String
|
the patch file |
required |
storageDir |
String
|
the storage directory |
required |
fileName |
String
|
the file name of the patch to be saved |
required |
Source code in src/core/commitLoader.py
get_file_type(file_path)
Guess a file type based upon a file extension (mimetypes module)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
String
|
the file path |
required |
Return
magic_ext