mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-24 05:38:25 +00:00
32 lines
738 B
Python
32 lines
738 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
|
|
|
|
return instance
|
|
|
|
|
|
class GitRepoSchema(ma.Schema):
|
|
class Meta:
|
|
model = GitRepo
|
|
fields = ["directory", "branch", "merge_branch", "changes", "untracked"]
|
|
|
|
|
|
class GitCommit(object):
|
|
pass
|
|
|
|
|
|
class GitCommitSchema(ma.Schema):
|
|
class Meta:
|
|
model = GitCommit
|
|
fields = ["message", "files"]
|