mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Repository.get_git_tree (and .create_git_tree, not tested)
This commit is contained in:
@@ -83,6 +83,16 @@ GitCommit = GithubObject(
|
||||
),
|
||||
)
|
||||
|
||||
GitTree = GithubObject(
|
||||
"GitTree",
|
||||
BaseUrl( lambda obj: obj._repo._baseUrl + "/git/trees/" + obj.sha ),
|
||||
BasicAttributes(
|
||||
"sha", "url",
|
||||
"tree", ### @todo Structure
|
||||
"_repo", ### Ugly hack
|
||||
),
|
||||
)
|
||||
|
||||
__modifyAttributesForGitObjects = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj }.iteritems() ) )
|
||||
Repository = GithubObject(
|
||||
"Repository",
|
||||
@@ -111,6 +121,10 @@ Repository = GithubObject(
|
||||
ElementGetable( "git_commit", lambda repo, sha: { "_repo": repo, "sha": sha } ),
|
||||
ElementCreatable( "git_commit", [ "message", "tree", "parents" ], [ "author", "commiter" ], __modifyAttributesForGitObjects )
|
||||
),
|
||||
ListAttribute( "git/trees", GitTree,
|
||||
ElementGetable( "git_tree", lambda repo, sha: { "_repo": repo, "sha": sha } ),
|
||||
ElementCreatable( "git_tree", [ "tree" ], [], __modifyAttributesForGitObjects )
|
||||
),
|
||||
)
|
||||
Repository._addAttributePolicy( ComplexAttribute( "parent", Repository ) )
|
||||
Repository._addAttributePolicy( ComplexAttribute( "source", Repository ) )
|
||||
|
||||
Reference in New Issue
Block a user