aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdeodato Simó <dato@net.com.org.es>2008-04-12 16:41:28 +0200
committerGuido Guenther <agx@sigxcpu.org>2008-04-14 14:55:47 +0200
commitbaaf482179c10e936f4e506d58736870e4cde6a5 (patch)
tree1a846c967b6f2260d582acf39e2fe949df3606df
parent6e2a67576afc1dcb4a947851351e6b3c02564d07 (diff)
Make commits from git-import-dsc get author and date from debian/changelog.
This is done by setting GIT_AUTHOR_{NAME,EMAIL,DATE} before invoking git-commit. GIT_COMMITTER_* are left alone (i.e., the date of the import will be available from there). (cherry picked from commit acee866d1d89327aa530b6531b50b4edcc524906)
-rw-r--r--gbp/command_wrappers.py8
-rwxr-xr-xgit-import-dsc14
2 files changed, 15 insertions, 7 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py
index e986113..36dd5be 100644
--- a/gbp/command_wrappers.py
+++ b/gbp/command_wrappers.py
@@ -140,8 +140,8 @@ class DpkgSourceExtract(Command):
class GitCommand(Command):
"Mother/Father of all git commands"
- def __init__(self, cmd, args=[]):
- Command.__init__(self, 'git', [cmd] + args)
+ def __init__(self, cmd, args=[], **kwargs):
+ Command.__init__(self, 'git', [cmd] + args, **kwargs)
class GitInitDB(GitCommand):
@@ -219,9 +219,9 @@ class GitRm(GitCommand):
class GitCommitAll(GitCommand):
"""Wrap git commit to commit all changes"""
- def __init__(self, verbose=False):
+ def __init__(self, verbose=False, **kwargs):
args = ['-a'] + [ ['-q'], [] ][verbose]
- GitCommand.__init__(self, cmd='commit', args=args)
+ GitCommand.__init__(self, cmd='commit', args=args, **kwargs)
def __call__(self, msg=''):
args = [ [], ['-m', msg] ][len(msg) > 0]
diff --git a/git-import-dsc b/git-import-dsc
index 87fd90f..442cbc1 100755
--- a/git-import-dsc
+++ b/git-import-dsc
@@ -23,9 +23,10 @@ import os
import tempfile
import glob
import pipes
+from email.Utils import parseaddr
import gbp.command_wrappers as gbpc
-from gbp.deb_utils import debian_version_chars, unpack_orig
-from gbp.git_utils import build_tag, GitRepository, GitRepositoryError, replace_source_tree
+from gbp.deb_utils import debian_version_chars, parse_changelog, unpack_orig
+from gbp.git_utils import build_tag, GitRepository, GitRepositoryError, replace_source_tree, rfc822_date_to_git
from gbp.config import GbpOptionParser
from gbp.errors import GbpError
@@ -145,7 +146,14 @@ def apply_debian_patch(src, dirs, options):
raise GbpError
os.chmod('debian/rules', 0755)
if not repo.is_clean()[0]:
- gbpc.GitCommitAll()(msg="Imported Debian patch %s" % version)
+ dch = parse_changelog('debian/changelog')
+ name, addr = parseaddr(dch['Maintainer'])
+ env = {
+ 'GIT_AUTHOR_NAME': name,
+ 'GIT_AUTHOR_EMAIL': addr,
+ 'GIT_AUTHOR_DATE': rfc822_date_to_git(dch['Date']),
+ }
+ gbpc.GitCommitAll(extra_env=env)(msg="Imported Debian patch %s" % version)
else:
print "Nothing to commit, nothing imported."
gitTag(build_tag(options.debian_tag, version),