summaryrefslogtreecommitdiff
path: root/lib/git/objects/commit.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-18 23:11:32 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-18 23:11:32 +0100
commitf1545bd9cd6953c5b39c488bf7fe179676060499 (patch)
tree8bd4b8829768fe0195d41a3aa067aa1ac7435605 /lib/git/objects/commit.py
parenta1d1d2cb421f16bd277d7c4ce88398ff0f5afb29 (diff)
parent7cf2d5fcf0a3db793678dd6ba9fc1c24d4eeb36a (diff)
downloadgitpython-f1545bd9cd6953c5b39c488bf7fe179676060499.tar.gz
Merge branch 'submodule'
Diffstat (limited to 'lib/git/objects/commit.py')
-rw-r--r--lib/git/objects/commit.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/lib/git/objects/commit.py b/lib/git/objects/commit.py
index 58c82da2..a2b6c554 100644
--- a/lib/git/objects/commit.py
+++ b/lib/git/objects/commit.py
@@ -108,7 +108,26 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
super(Commit,self).__init__(repo, binsha)
if tree is not None:
assert isinstance(tree, Tree), "Tree needs to be a Tree instance, was %s" % type(tree)
- self._set_self_from_args_(locals())
+ if tree is not None:
+ self.tree = tree
+ if author is not None:
+ self.author = author
+ if authored_date is not None:
+ self.authored_date = authored_date
+ if author_tz_offset is not None:
+ self.author_tz_offset = author_tz_offset
+ if committer is not None:
+ self.committer = committer
+ if committed_date is not None:
+ self.committed_date = committed_date
+ if committer_tz_offset is not None:
+ self.committer_tz_offset = committer_tz_offset
+ if message is not None:
+ self.message = message
+ if parents is not None:
+ self.parents = parents
+ if encoding is not None:
+ self.encoding = encoding
@classmethod
def _get_intermediate_items(cls, commit):
@@ -346,6 +365,9 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
new_commit.binsha = istream.binsha
if head:
+ # need late import here, importing git at the very beginning throws
+ # as well ...
+ import git.refs
try:
repo.head.commit = new_commit
except ValueError:
@@ -434,7 +456,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
try:
self.author.name = self.author.name.decode(self.encoding)
except UnicodeDecodeError:
- print >> sys.stderr, "Failed to decode author name: %s" % self.author.name
+ print >> sys.stderr, "Failed to decode author name '%s' using encoding %s" % (self.author.name, self.encoding)
# END handle author's encoding
# a stream from our data simply gives us the plain message
@@ -443,7 +465,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
try:
self.message = self.message.decode(self.encoding)
except UnicodeDecodeError:
- print >> sys.stderr, "Failed to decode message: %s" % self.message
+ print >> sys.stderr, "Failed to decode message '%s' using encoding %s" % (self.message, self.encoding)
# END exception handling
return self