summaryrefslogtreecommitdiff
path: root/objects/commit.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-23 21:14:59 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-23 21:14:59 +0100
commita21a9f6f13861ddc65671b278e93cf0984adaa30 (patch)
tree67e30aa7a870bedc238ea6eed0e991dc1a80083a /objects/commit.py
parent5bd7d44ff7e51105e3e277aee109a45c42590572 (diff)
downloadgitpython-a21a9f6f13861ddc65671b278e93cf0984adaa30.tar.gz
Actor: Moved it from git.objects.util to git.util, adjusted all imports accordingly. Added methods to Actor to retrieve the global committer and author information
Reflog: implemented and tested append_entry method
Diffstat (limited to 'objects/commit.py')
-rw-r--r--objects/commit.py27
1 files changed, 4 insertions, 23 deletions
diff --git a/objects/commit.py b/objects/commit.py
index a2b6c554..9c7e66a3 100644
--- a/objects/commit.py
+++ b/objects/commit.py
@@ -4,7 +4,8 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-from git.util import (
+from git.util import (
+ Actor,
Iterable,
Stats,
)
@@ -20,9 +21,7 @@ from gitdb.util import (
from util import (
Traversable,
Serializable,
- get_user_id,
parse_date,
- Actor,
altz_to_utctz_str,
parse_actor_and_date
)
@@ -43,17 +42,10 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# ENVIRONMENT VARIABLES
# read when creating new commits
- env_author_name = "GIT_AUTHOR_NAME"
- env_author_email = "GIT_AUTHOR_EMAIL"
env_author_date = "GIT_AUTHOR_DATE"
- env_committer_name = "GIT_COMMITTER_NAME"
- env_committer_email = "GIT_COMMITTER_EMAIL"
env_committer_date = "GIT_COMMITTER_DATE"
- env_email = "EMAIL"
# CONFIGURATION KEYS
- conf_name = 'name'
- conf_email = 'email'
conf_encoding = 'i18n.commitencoding'
# INVARIANTS
@@ -306,17 +298,9 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
# COMMITER AND AUTHOR INFO
cr = repo.config_reader()
env = os.environ
- default_email = get_user_id()
- default_name = default_email.split('@')[0]
- conf_name = cr.get_value('user', cls.conf_name, default_name)
- conf_email = cr.get_value('user', cls.conf_email, default_email)
-
- author_name = env.get(cls.env_author_name, conf_name)
- author_email = env.get(cls.env_author_email, conf_email)
-
- committer_name = env.get(cls.env_committer_name, conf_name)
- committer_email = env.get(cls.env_committer_email, conf_email)
+ committer = Actor.committer(cr)
+ author = Actor.author(cr)
# PARSE THE DATES
unix_time = int(time())
@@ -340,9 +324,6 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
enc_section, enc_option = cls.conf_encoding.split('.')
conf_encoding = cr.get_value(enc_section, enc_option, cls.default_encoding)
- author = Actor(author_name, author_email)
- committer = Actor(committer_name, committer_email)
-
# if the tree is no object, make sure we create one - otherwise
# the created commit object is invalid