mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
Repository.create_git_tag and .get_git_tag
This commit is contained in:
@@ -150,6 +150,8 @@ class IntegrationTest:
|
||||
t2 = r.create_git_tree( [ { "path": "foo.bar", "mode": "100644", "type": "blob", "sha": b2.sha }, { "path": "old", "mode": "040000", "type": "tree", "sha": t1.sha } ] )
|
||||
c2 = r.create_git_commit( "This commit was also created by PyGithub", t2.sha, [ c1.sha ] )
|
||||
master.edit( c2.sha )
|
||||
tag = r.create_git_tag( "a_tag", "This tag was created by PyGithub", c2.sha, "commit" )
|
||||
r.create_git_ref( "refs/tags/a_tag", tag.sha )
|
||||
self.dumpRepository( r )
|
||||
|
||||
def dumpUser( self, u ):
|
||||
|
||||
+2
-2
@@ -196,11 +196,11 @@ API `/repos/:user/:repo/git/refs/:ref`
|
||||
|
||||
API `/repos/:user/:repo/git/tags`
|
||||
=================================
|
||||
* POST: `Repository.create_git_tag( ... )`: `GitTag` (TODO SOON)
|
||||
* POST: `Repository.create_git_tag( ... )`: `GitTag`
|
||||
|
||||
API `/repos/:user/:repo/git/tags/:sha`
|
||||
======================================
|
||||
* GET: `Repository.get_git_tag( sha )`: `GitTag` (TODO SOON)
|
||||
* GET: `Repository.get_git_tag( sha )`: `GitTag`
|
||||
|
||||
API `/repos/:user/:repo/git/trees`
|
||||
==================================
|
||||
|
||||
@@ -103,6 +103,18 @@ GitBlob = GithubObject(
|
||||
),
|
||||
)
|
||||
|
||||
GitTag = GithubObject(
|
||||
"GitTag",
|
||||
BaseUrl( lambda obj: obj._repo._baseUrl + "/git/tags/" + obj.sha ),
|
||||
BasicAttributes(
|
||||
"tag", "sha", "url",
|
||||
"message",
|
||||
"tagger", ### @todo Structure
|
||||
"object", ### @todo Structure
|
||||
"_repo", ### Ugly hack
|
||||
),
|
||||
)
|
||||
|
||||
__modifyAttributesForGitObjects = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj }.iteritems() ) )
|
||||
Repository = GithubObject(
|
||||
"Repository",
|
||||
@@ -139,6 +151,10 @@ Repository = GithubObject(
|
||||
ElementGetable( "git_blob", lambda repo, sha: { "_repo": repo, "sha": sha } ),
|
||||
ElementCreatable( "git_blob", [ "content", "encoding" ], [], __modifyAttributesForGitObjects )
|
||||
),
|
||||
ListAttribute( "git/tags", GitTag,
|
||||
ElementGetable( "git_tag", lambda repo, sha: { "_repo": repo, "sha": sha } ),
|
||||
ElementCreatable( "git_tag", [ "tag", "message", "object", "type" ], [ "tagger" ], __modifyAttributesForGitObjects )
|
||||
),
|
||||
)
|
||||
Repository._addAttributePolicy( ComplexAttribute( "parent", Repository ) )
|
||||
Repository._addAttributePolicy( ComplexAttribute( "source", Repository ) )
|
||||
|
||||
Reference in New Issue
Block a user