Remove complete-ability from git objects

This commit is contained in:
Vincent Jacques
2012-05-12 14:14:31 +02:00
parent 8956796e7f
commit 71b0ede8de
8 changed files with 6 additions and 135 deletions
-21
View File
@@ -14,32 +14,25 @@ class GitBlob( object ):
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
if not lazy:
self.__complete()
@property
def content( self ):
self.__completeIfNeeded( self.__content )
return self.__content
@property
def encoding( self ):
self.__completeIfNeeded( self.__encoding )
return self.__encoding
@property
def sha( self ):
self.__completeIfNeeded( self.__sha )
return self.__sha
@property
def size( self ):
self.__completeIfNeeded( self.__size )
return self.__size
@property
def url( self ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
@@ -49,20 +42,6 @@ class GitBlob( object ):
self.__size = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
def __complete( self ):
status, headers, data = self.__requester.request(
"GET",
self.__url,
None,
None
)
self.__useAttributes( data )
self.__completed = True
def __useAttributes( self, attributes ):
# @todo Remove this debug weakness: we shall assume that github will add new attributes
for attribute in attributes:
-23
View File
@@ -17,42 +17,33 @@ class GitCommit( object ):
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
if not lazy:
self.__complete()
@property
def author( self ):
self.__completeIfNeeded( self.__author )
return self.__author
@property
def committer( self ):
self.__completeIfNeeded( self.__committer )
return self.__committer
@property
def message( self ):
self.__completeIfNeeded( self.__message )
return self.__message
@property
def parents( self ):
self.__completeIfNeeded( self.__parents )
return self.__parents
@property
def sha( self ):
self.__completeIfNeeded( self.__sha )
return self.__sha
@property
def tree( self ):
self.__completeIfNeeded( self.__tree )
return self.__tree
@property
def url( self ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
@@ -64,20 +55,6 @@ class GitCommit( object ):
self.__tree = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
def __complete( self ):
status, headers, data = self.__requester.request(
"GET",
self.__url,
None,
None
)
self.__useAttributes( data )
self.__completed = True
def __useAttributes( self, attributes ):
# @todo Remove this debug weakness: we shall assume that github will add new attributes
for attribute in attributes:
-19
View File
@@ -14,22 +14,17 @@ class GitObject( object ):
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
if not lazy:
self.__complete()
@property
def sha( self ):
self.__completeIfNeeded( self.__sha )
return self.__sha
@property
def type( self ):
self.__completeIfNeeded( self.__type )
return self.__type
@property
def url( self ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
@@ -37,20 +32,6 @@ class GitObject( object ):
self.__type = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
def __complete( self ):
status, headers, data = self.__requester.request(
"GET",
self.__url,
None,
None
)
self.__useAttributes( data )
self.__completed = True
def __useAttributes( self, attributes ):
# @todo Remove this debug weakness: we shall assume that github will add new attributes
for attribute in attributes:
-19
View File
@@ -15,22 +15,17 @@ class GitRef( object ):
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
if not lazy:
self.__complete()
@property
def object( self ):
self.__completeIfNeeded( self.__object )
return self.__object
@property
def ref( self ):
self.__completeIfNeeded( self.__ref )
return self.__ref
@property
def url( self ):
self.__completeIfNeeded( self.__url )
return self.__url
def delete( self ):
@@ -60,20 +55,6 @@ class GitRef( object ):
self.__ref = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
def __complete( self ):
status, headers, data = self.__requester.request(
"GET",
self.__url,
None,
None
)
self.__useAttributes( data )
self.__completed = True
def __useAttributes( self, attributes ):
# @todo Remove this debug weakness: we shall assume that github will add new attributes
for attribute in attributes:
-22
View File
@@ -16,37 +16,29 @@ class GitTag( object ):
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
if not lazy:
self.__complete()
@property
def message( self ):
self.__completeIfNeeded( self.__message )
return self.__message
@property
def object( self ):
self.__completeIfNeeded( self.__object )
return self.__object
@property
def sha( self ):
self.__completeIfNeeded( self.__sha )
return self.__sha
@property
def tag( self ):
self.__completeIfNeeded( self.__tag )
return self.__tag
@property
def tagger( self ):
self.__completeIfNeeded( self.__tagger )
return self.__tagger
@property
def url( self ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
@@ -57,20 +49,6 @@ class GitTag( object ):
self.__tagger = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
def __complete( self ):
status, headers, data = self.__requester.request(
"GET",
self.__url,
None,
None
)
self.__useAttributes( data )
self.__completed = True
def __useAttributes( self, attributes ):
# @todo Remove this debug weakness: we shall assume that github will add new attributes
for attribute in attributes:
-19
View File
@@ -15,22 +15,17 @@ class GitTree( object ):
self.__completed = False
self.__initAttributes()
self.__useAttributes( attributes )
if not lazy:
self.__complete()
@property
def sha( self ):
self.__completeIfNeeded( self.__sha )
return self.__sha
@property
def tree( self ):
self.__completeIfNeeded( self.__tree )
return self.__tree
@property
def url( self ):
self.__completeIfNeeded( self.__url )
return self.__url
def __initAttributes( self ):
@@ -38,20 +33,6 @@ class GitTree( object ):
self.__tree = None
self.__url = None
def __completeIfNeeded( self, testedAttribute ):
if not self.__completed and testedAttribute is None:
self.__complete()
def __complete( self ):
status, headers, data = self.__requester.request(
"GET",
self.__url,
None,
None
)
self.__useAttributes( data )
self.__completed = True
def __useAttributes( self, attributes ):
# @todo Remove this debug weakness: we shall assume that github will add new attributes
for attribute in attributes: