1.Which are the common methods of the Graal backends?
Common methods of Graal backends are:
- fetch() :
syntax :fetch(self, category=CATEGORY_GRAAL, from_date=DEFAULT_DATETIME, to_date=DEFAULT_LAST_DATETIME,branches=None, latest_items=False)
Fetch commits and supports the inclusion of code analysis information. The method retrieves from a repository a list of commits. Commits are returned in the same order they were obtained.
:param category: the category of items to fetch
:param from_date: obtain commits newer than a specific date (inclusive)
:param to_date: obtain commits older than a specific date
:param branches: names of branches to fetch from (default: None)
:param latest_items: sync with the repository to fetch only the newest commits
:returns: a generator of commits.
-
metadata_category() :
syntax :metadata_category(item)
Extracts the category from a Graal item. This backend only generates one type of item which is 'commit'. -
analyze() :
syntax :_analyze(self, commit)
Analyze a commit and the corresponding checkout version of the repository
:param commit: a Perceval commit item
2.List and explain at least 2 Git commands used by Graal (and not implemented in Perceval).
Git commands used by Graal are:
-
worktree() :
syntax :worktree(self, worktreepath, branch=None)
Create a working tree of the cloned repository with the active branch set tobranch
.The worktree is needed to perform "write" operations (e.g., git checkout), which cannot be done on a git bare repo.
:param worktreepath: the path where the working tree will be located
:param branch: the name of the branch. If None, the branch is set tomaster
-
prune() :
syntax:prune(self)
Delete a working tree from disk.
:param worktreepath: directory where the working tree is located. -
checkout() :
syntax :checkout(self, hash)
Checkout a Git repository at a given commit.
:param hash: the hash of a commit