From 1d2b27824d20612066d84be42d6691c66bb18ef4 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Mon, 19 Mar 2012 07:32:34 +0100 Subject: [PATCH] Repository.get_git_tree with 'recursive' --- ReferenceOfApis.md | 4 ---- ReferenceOfClasses.md | 5 +++-- github/GithubObjects/GitTree.py | 4 ++-- github/GithubObjects/Repository.py | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ReferenceOfApis.md b/ReferenceOfApis.md index b4e8bf49..04372696 100644 --- a/ReferenceOfApis.md +++ b/ReferenceOfApis.md @@ -210,10 +210,6 @@ API `/repos/:user/:repo/git/trees/:sha` ======================================= * GET: `Repository.get_git_tree` -API `/repos/:user/:repo/git/trees/:sha?recursive=1` -=================================================== -* GET: (TODO) - API `/repos/:user/:repo/hooks` ============================== * GET: `Repository.get_hooks` diff --git a/ReferenceOfClasses.md b/ReferenceOfClasses.md index 695b67b1..fc85d0ed 100644 --- a/ReferenceOfClasses.md +++ b/ReferenceOfClasses.md @@ -363,6 +363,7 @@ Attributes * `sha` * `url` * `tree` +* `recursive` Class `Hook` ============ @@ -842,8 +843,8 @@ Git commits Git trees --------- -* `get_git_tree( sha )`: `GitTree` -* `create_git_tree( tree )`: `GitTree` +* `get_git_tree( sha, [recursive] )`: `GitTree` +* `create_git_tree( tree, [base_tree] )`: `GitTree` Git blobs --------- diff --git a/github/GithubObjects/GitTree.py b/github/GithubObjects/GitTree.py index a7ac8bd5..87666f3f 100644 --- a/github/GithubObjects/GitTree.py +++ b/github/GithubObjects/GitTree.py @@ -2,10 +2,10 @@ from GithubObject import * GitTree = GithubObject( "GitTree", - BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/trees/" + obj.sha ), + BaseUrl( lambda obj: obj._repo._baseUrl() + "/git/trees/" + obj.sha + "?recursive=1" if obj.recursive else "" ), InternalSimpleAttributes( "sha", "url", "tree", - "_repo", + "_repo", "recursive", ), ) diff --git a/github/GithubObjects/Repository.py b/github/GithubObjects/Repository.py index 05579294..3024075e 100644 --- a/github/GithubObjects/Repository.py +++ b/github/GithubObjects/Repository.py @@ -86,7 +86,7 @@ Repository._addAttributePolicy( SeveralAttributePolicies( [ ElementCreatable( Parameters( [ "message", "tree", "parents" ], [ "author", "committer" ] ), __modifyAttributesForObjectsReferingRepo ) ), ExternalListOfObjects( "git/trees", "git_tree", GitTree, - ElementGetable( Parameters( [ "sha" ], [] ), __modifyAttributesForObjectsReferingRepo ), + ElementGetable( Parameters( [ "sha" ], [ "recursive" ] ), __modifyAttributesForObjectsReferingRepo ), ElementCreatable( Parameters( [ "tree" ], [ "base_tree" ] ), __modifyAttributesForObjectsReferingRepo ) ), ExternalListOfObjects( "git/blobs", "git_blob", GitBlob,