def __init__(self, repo, id, mode=None, name=None): LazyMixin.__init__(self) self.repo = repo self.id = id self.mode = mode self.name = name self._contents = None
def __init__(self, repo, id, tree=None, author=None, authored_date=None, committer=None, committed_date=None, message=None, parents=None): """ Instantiate a new Commit ``id`` is the id of the commit ``parents`` is a list of commit ids (will be converted into Commit instances) ``tree`` is the correspdonding tree id (will be converted into a Tree object) ``author`` is the author string ``authored_date`` is the authored DateTime ``committer`` is the committer string ``committed_date`` is the committed DateTime ``message`` is the commit message ``parents`` is the list of the parents of the commit Returns git.Commit """ LazyMixin.__init__(self) self.repo = repo self.id = id self.parents = None self.tree = None self.author = author self.authored_date = authored_date self.committer = committer self.committed_date = committed_date self.message = message if self.id: if parents is not None: self.parents = [Commit(repo, p) for p in parents] if tree is not None: self.tree = Tree(repo, id=tree)
def __init__(self, repo, id, tree=None, author=None, authored_date=None, committer=None, committed_date=None, message=None, parents=None): """ Instantiate a new Commit. All keyword arguments taking None as default will be implicitly set if id names a valid sha. The parameter documentation indicates the type of the argument after a colon ':'. ``id`` is the sha id of the commit ``parents`` : list( Commit, ... ) is a list of commit ids ``tree`` : Tree is the corresponding tree id ``author`` : Actor is the author string ( will be implicitly converted into an Actor object ) ``authored_date`` : (tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst ) is the authored DateTime ``committer`` : Actor is the committer string ``committed_date`` : (tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec, tm_wday, tm_yday, tm_isdst) is the committed DateTime ``message`` : string is the commit message Returns git.Commit """ LazyMixin.__init__(self) self.repo = repo self.id = id self.parents = None self.tree = None self.author = author self.authored_date = authored_date self.committer = committer self.committed_date = committed_date self.message = message if self.id: if parents is not None: self.parents = [Commit(repo, p) for p in parents] if tree is not None: self.tree = Tree(repo, id=tree)
def __init__(self, repo, id, tree=None, author=None, authored_date=None, committer=None, committed_date=None, message=None, parents=None): """ Instantiate a new Commit ``id`` is the id of the commit ``parents`` is a list of commit ids (will be converted into Commit instances) ``tree`` is the correspdonding tree id (will be converted into a Tree object) ``author`` is the author string ``authored_date`` is the authored DateTime ``committer`` is the committer string ``committed_date`` is the committed DateTime ``message`` is the first line of the commit message ``parents`` is the list of the parents of the commit Returns git.Commit """ LazyMixin.__init__(self) self.repo = repo self.id = id self.parents = None self.tree = None self.author = author self.authored_date = authored_date self.committer = committer self.committed_date = committed_date self.message = message if self.id: if parents is not None: self.parents = [Commit(repo, p) for p in parents] if tree is not None: self.tree = Tree(repo, id=tree)
def __init__(self, repo, id, mode=None, name=None, commit_context='', path=''): LazyMixin.__init__(self) self.repo = repo self.id = id self.mode = mode self.name = name # commit_context (A string with ID of the commit) is a "crutch" that # allows us to look up details for submodules, should we find any in # this particular tree. # Trees don't have a reference to parent (commit, other tree). # They can have infinite amounts of parents. # However, we need to know what commit got us to this particular # tree if we want to know the URI of the submodule. # The commit ID of the repo pointed out by submodule is here, in the tree. # However, the only way to know what URI that submodule refers to is # to read .gitmodules file that's in the top-most tree of SOME commit. # Each commit can have a different version of .gitmodule, but through # tree chain lead to the same Tree instance where the submodule is rooted. # # There is a short-cut. If submodule is placed in top-most Tree in a # commit (i.e. submodule's path value is "mysubmodule") the .gitmodules # file will be in the same exact tree. YEY! we just read that and know # the submodule's URI. Shortcut is gone when submodule is nested in the # commit like so: "commonfolder/otherfolder/mysubmodule" In this case, # commit's root tree will have "Tree 'commonfolder'" which will have # "Tree "otherfolder", which will have "Submodule 'mysubmodule'" # By the time we get to "Tree 'otherfolder'" we don't know where to # look for ".gitmodules". This is what commit_context is for. # The only way you get a value here if you either set it by hand, or # traverse the Tree chain that started with CommitInstance.tree, which # populates the context upon Tree instantiation. self.commit_context = commit_context # path is the friend commit_context. since trees don't have links to # parents, we have no clue what the "full local path" of a child # submodule would be. Submodules are listed as "name" in trees and # as "folder/folder/name" in .gitmodules. path helps us keep up with the # the folder changes. self.path = path self._contents = None
def __init__(self, repo, id, mode=None, name=None, commit_context = '', path = ''): LazyMixin.__init__(self) self.repo = repo self.id = id self.mode = mode self.name = name # commit_context (A string with ID of the commit) is a "crutch" that # allows us to look up details for submodules, should we find any in # this particular tree. # Trees don't have a reference to parent (commit, other tree). # They can have infinite amounts of parents. # However, we need to know what commit got us to this particular # tree if we want to know the URI of the submodule. # The commit ID of the repo pointed out by submodule is here, in the tree. # However, the only way to know what URI that submodule refers to is # to read .gitmodules file that's in the top-most tree of SOME commit. # Each commit can have a different version of .gitmodule, but through # tree chain lead to the same Tree instance where the submodule is rooted. # # There is a short-cut. If submodule is placed in top-most Tree in a # commit (i.e. submodule's path value is "mysubmodule") the .gitmodules # file will be in the same exact tree. YEY! we just read that and know # the submodule's URI. Shortcut is gone when submodule is nested in the # commit like so: "commonfolder/otherfolder/mysubmodule" In this case, # commit's root tree will have "Tree 'commonfolder'" which will have # "Tree "otherfolder", which will have "Submodule 'mysubmodule'" # By the time we get to "Tree 'otherfolder'" we don't know where to # look for ".gitmodules". This is what commit_context is for. # The only way you get a value here if you either set it by hand, or # traverse the Tree chain that started with CommitInstance.tree, which # populates the context upon Tree instantiation. self.commit_context = commit_context # path is the friend commit_context. since trees don't have links to # parents, we have no clue what the "full local path" of a child # submodule would be. Submodules are listed as "name" in trees and # as "folder/folder/name" in .gitmodules. path helps us keep up with the # the folder changes. self.path = path self._contents = None