summaryrefslogtreecommitdiff
path: root/lib/git/commit.py
diff options
context:
space:
mode:
authorSteve Frécinaux <code@istique.net>2008-09-06 00:35:04 +0200
committerSteve Frécinaux <code@istique.net>2008-09-06 00:35:04 +0200
commitc8c50d8be2dc5ae74e53e44a87f580bf25956af9 (patch)
tree39348788be4e9acf31abcf4d81e391cdd9183304 /lib/git/commit.py
parent2f6a6e35d003c243968cdb41b72fbbe609e56841 (diff)
downloadgitpython-c8c50d8be2dc5ae74e53e44a87f580bf25956af9.tar.gz
Do not use **kwargs for constructors.
It is better to have an explicit list of variables for the constructors, be it only to avoid mispelled arguments.
Diffstat (limited to 'lib/git/commit.py')
-rw-r--r--lib/git/commit.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/git/commit.py b/lib/git/commit.py
index 13472deb..93a2b70f 100644
--- a/lib/git/commit.py
+++ b/lib/git/commit.py
@@ -9,12 +9,13 @@ import time
from actor import Actor
from lazy import LazyMixin
-import tree
+from tree import Tree
import diff
import stats
class Commit(LazyMixin):
- def __init__(self, repo, **kwargs):
+ 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
@@ -42,29 +43,29 @@ class Commit(LazyMixin):
``message``
is the first line of the commit message
+ ``parents``
+ is the list of the parents of the commit
+
Returns
GitPython.Commit
"""
LazyMixin.__init__(self)
self.repo = repo
- self.id = None
- self.tree = None
- self.author = None
- self.authored_date = None
- self.committer = None
- self.committed_date = None
- self.message = None
+ self.id = id
self.parents = None
-
- for k, v in kwargs.items():
- setattr(self, k, v)
+ 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' in kwargs:
- self.parents = map(lambda p: Commit(repo, id=p), kwargs['parents'])
- if 'tree' in kwargs:
- self.tree = tree.Tree(repo, id=kwargs['tree'])
+ 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 __bake__(self):
temp = Commit.find_all(self.repo, self.id, max_count=1)[0]