def log(project_id, number): # Load project from internal database project = models.Project.query.filter_by(id=project_id).first() # Init git wrap gitWrap = GitWrap(project.repository, config.REPOSITORIES) gitWrap.init() return ValidationResult([CommitWrap(n).getVars() for n in gitWrap.log(number)])
def getRevisionDifference(repository, prevRevision, revision): # Init git wrap gitWrap = GitWrap(repository, config.REPOSITORIES) gitWrap.init() # Get commit changes patch = gitWrap.get_commit_diff(prevRevision, revision) # Parse patch return ValidationResult(Parser.run(patch).getVars())
def exists(project_id): # Load project from internal database project = models.Project.query.filter_by(id=project_id).first() # Init git wrap gitWrap = GitWrap(project.repository, config.REPOSITORIES) result = { "exists" : gitWrap.init() } # Init validation return ValidationResult(result)
def getCommitByRepository(repository, prevRevision, revision): # Init git wrap gitWrap = GitWrap(repository, config.REPOSITORIES) gitWrap.init() # Load commit commit = gitWrap.get_commit(revision) commitWrap = CommitWrap(commit) # Get commit changes commitWrap.diff = RepositoryService.getRevisionDifference(repository, prevRevision, revision).data; # Return result return ValidationResult(commitWrap.getVars())