mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 21:28:32 +00:00
*** WIP *** Still need to add some tests for this. Committing so we can work on the frontend
34 lines
873 B
Python
34 lines
873 B
Python
from crc import app, ma
|
|
|
|
|
|
class GitRepo(object):
|
|
|
|
@classmethod
|
|
def from_repo(cls, repo):
|
|
instance = cls()
|
|
instance.directory = repo.working_dir
|
|
instance.branch = repo.active_branch.name
|
|
instance.merge_branch = app.config['GIT_MERGE_BRANCH']
|
|
instance.changes = [item.a_path for item in repo.index.diff(None)]
|
|
instance.untracked = repo.untracked_files
|
|
instance.display_push = repo.display_push
|
|
instance.display_merge = repo.display_merge
|
|
|
|
return instance
|
|
|
|
|
|
class GitRepoSchema(ma.Schema):
|
|
class Meta:
|
|
model = GitRepo
|
|
fields = ["directory", "branch", "merge_branch", "changes", "untracked", "display_push", "display_merge"]
|
|
|
|
|
|
class GitCommit(object):
|
|
pass
|
|
|
|
|
|
class GitCommitSchema(ma.Schema):
|
|
class Meta:
|
|
model = GitCommit
|
|
fields = ["message", "files"]
|