[Erp5-report] r45085 jm - /erp5/trunk/products/ERP5VCS/Git.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Apr 5 14:28:03 CEST 2011
Author: jm
Date: Tue Apr 5 14:28:03 2011
New Revision: 45085
URL: http://svn.erp5.org?rev=45085&view=rev
Log:
ERP5VCS: fix git committer to be the same as the author (if specified in preferences)
Modified:
erp5/trunk/products/ERP5VCS/Git.py
Modified: erp5/trunk/products/ERP5VCS/Git.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5VCS/Git.py?rev=45085&r1=45084&r2=45085&view=diff
==============================================================================
--- erp5/trunk/products/ERP5VCS/Git.py [utf8] (original)
+++ erp5/trunk/products/ERP5VCS/Git.py [utf8] Tue Apr 5 14:28:03 2011
@@ -26,7 +26,7 @@
#
##############################################################################
-import os, subprocess
+import os, re, subprocess
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from DateTime import DateTime
@@ -236,15 +236,15 @@ class Git(WorkingCopy):
portal = self.getPortalObject()
author = portal.portal_preferences.getPreferredGitAuthor()
if author:
- author = author.strip()
+ author = re.match(r'\s*([^<>]+?)\s+<(\S+)>\s*$', author)
if author:
- return author
+ return author.groups()
#try:
# author = portal.ERP5Site_getAuthenticatedMemberPersonValue()
# name = author.getTitle()
# email = author.getDefaultEmailText()
# if name and email:
- # return '%s <%s>' % (name, email)
+ # return name, email
#except AttributeError:
# pass
@@ -263,11 +263,15 @@ class Git(WorkingCopy):
selected_set.update(removed)
# remove directories from selected_set
selected_set.intersection_update(self._patch_with_raw()[0])
- args = ['commit', '-m', changelog, '--']
+ args = ['commit', '-m', changelog, '--'] + list(selected_set)
author = self.getAuthor()
if author:
- args[1:1] = '--author', author
- self.git(*(args + list(selected_set)))
+ name, email = author
+ env = dict(os.environ, GIT_AUTHOR_NAME=name, GIT_COMMITTER_NAME=name,
+ GIT_AUTHOR_EMAIL=email, GIT_COMMITTER_EMAIL=email)
+ else:
+ env = None
+ self.git(*args, env=env)
self.clean()
try:
if push:
More information about the Erp5-report
mailing list