Commit 6f320fb0 authored by Julien Muchembled's avatar Julien Muchembled

ERP5VCS: fix git committer to be the same as the author (if specified in preferences)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45085 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 430e4c01
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# #
############################################################################## ##############################################################################
import os, subprocess import os, re, subprocess
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
from DateTime import DateTime from DateTime import DateTime
...@@ -236,15 +236,15 @@ class Git(WorkingCopy): ...@@ -236,15 +236,15 @@ class Git(WorkingCopy):
portal = self.getPortalObject() portal = self.getPortalObject()
author = portal.portal_preferences.getPreferredGitAuthor() author = portal.portal_preferences.getPreferredGitAuthor()
if author: if author:
author = author.strip() author = re.match(r'\s*([^<>]+?)\s+<(\S+)>\s*$', author)
if author: if author:
return author return author.groups()
#try: #try:
# author = portal.ERP5Site_getAuthenticatedMemberPersonValue() # author = portal.ERP5Site_getAuthenticatedMemberPersonValue()
# name = author.getTitle() # name = author.getTitle()
# email = author.getDefaultEmailText() # email = author.getDefaultEmailText()
# if name and email: # if name and email:
# return '%s <%s>' % (name, email) # return name, email
#except AttributeError: #except AttributeError:
# pass # pass
...@@ -263,11 +263,15 @@ class Git(WorkingCopy): ...@@ -263,11 +263,15 @@ class Git(WorkingCopy):
selected_set.update(removed) selected_set.update(removed)
# remove directories from selected_set # remove directories from selected_set
selected_set.intersection_update(self._patch_with_raw()[0]) selected_set.intersection_update(self._patch_with_raw()[0])
args = ['commit', '-m', changelog, '--'] args = ['commit', '-m', changelog, '--'] + list(selected_set)
author = self.getAuthor() author = self.getAuthor()
if author: if author:
args[1:1] = '--author', author name, email = author
self.git(*(args + list(selected_set))) 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() self.clean()
try: try:
if push: if push:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment