From e4d3809161fc54d6913c0c2c7f6a7b51eebe223f Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 21 Jan 2015 18:34:58 +0100 Subject: Added advance usage examples to tutorial and made minor fixes. GIT_PYTHON_TRACE would actually fail (now) if we debugged archive operations. Related to #239 --- git/objects/commit.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'git/objects/commit.py') diff --git a/git/objects/commit.py b/git/objects/commit.py index f2ce91ca..b9718694 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -69,6 +69,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): message=None, parents=None, encoding=None, gpgsig=None): """Instantiate a new Commit. All keyword arguments taking None as default will be implicitly set on first query. + :param binsha: 20 byte sha1 :param parents: tuple( Commit, ... ) is a tuple of commit ids or actual Commits @@ -97,7 +98,8 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): dependency graph :return: git.Commit - :note: Timezone information is in the same format and in the same sign + :note: + Timezone information is in the same format and in the same sign as what time.altzone returns. The sign is inverted compared to git's UTC timezone.""" super(Commit, self).__init__(repo, binsha) @@ -296,6 +298,11 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): # empty repositories have no head commit parent_commits = list() # END handle parent commits + else: + for p in parent_commits: + if not isinstance(p, cls): + raise ValueError("Parent commit '%r' must be of type %s" % (p, cls)) + # end check parent commit types # END if parent commits are unset # retrieve all additional information, create a commit object, and -- cgit v1.2.1