summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-01-19 18:59:45 +0100
committerGuido Günther <agx@sigxcpu.org>2011-01-22 15:32:55 +0100
commitd36077c1ff76113d6898c6ef1502c2e53f7318c6 (patch)
treeb0b1b6b081d1be027e2b7da0f4cfaf3de657f249
parent9054ae10dcde5070959d1c104e98afdb1c7e45cd (diff)
downloadgit-buildpackage-d36077c1ff76113d6898c6ef1502c2e53f7318c6.tar.gz
git-buildpackage-d36077c1ff76113d6898c6ef1502c2e53f7318c6.tar.bz2
git-buildpackage-d36077c1ff76113d6898c6ef1502c2e53f7318c6.zip
Add --author-is-comitter and --author-date-is-comitter-date commandline options
Closes: #610381
-rw-r--r--docs/manpages/git-import-dsc.sgml16
-rw-r--r--gbp.conf4
-rw-r--r--gbp/config.py6
-rw-r--r--gbp/git.py24
-rwxr-xr-xgit-import-dsc10
5 files changed, 53 insertions, 7 deletions
diff --git a/docs/manpages/git-import-dsc.sgml b/docs/manpages/git-import-dsc.sgml
index f31ee94a..3291b312 100644
--- a/docs/manpages/git-import-dsc.sgml
+++ b/docs/manpages/git-import-dsc.sgml
@@ -32,6 +32,8 @@
<arg><option>--[no-]pristine-tar</option></arg>
<arg><option>--download</option></arg>
<arg><option>--allow-same-versions</option></arg>
+ <arg><option>--author-is-committer</option></arg>
+ <arg><option>--author-date-is-committer-date</option></arg>
<arg choice="plain"><replaceable>debian-source.dsc</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -144,6 +146,20 @@
<para>Allow to import a package with the same debian version.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--author-is-committer</option>
+ </term>
+ <listitem>
+ <para>When importing the Debian patch make use the author as comitter.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--author-date-is-committer-date</option>
+ </term>
+ <listitem>
+ <para>When importing the Debian patch make use the author date as comitter date.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
<refsect1>
diff --git a/gbp.conf b/gbp.conf
index f4b334f5..573df42f 100644
--- a/gbp.conf
+++ b/gbp.conf
@@ -69,6 +69,10 @@
#upstream-branch = svn-upstream
# import filter:
#filter = [ 'CVS', '.cvsignore' ]
+#force committer to be the same as author
+#author-is-committer = True
+#same for the date
+#author-date-is-committer-date = True
# Options only affecting git-dch
[git-dch]
diff --git a/gbp/config.py b/gbp/config.py
index 7a4f7438..d1211334 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -97,6 +97,8 @@ class GbpOptionParser(OptionParser):
'notify' : 'auto',
'merge' : 'True',
'track' : 'True',
+ 'author-is-committer': 'False',
+ 'author-date-is-committer-date': 'False',
}
help = {
'debian-branch':
@@ -157,6 +159,10 @@ class GbpOptionParser(OptionParser):
"after the import merge the result to the debian branch, default is '%(merge)s'",
'track':
"set up tracking for remote branches, default is '%(track)s'",
+ 'author-is-committer':
+ "Use the authors's name also as the comitter's name, default is '%(author-is-committer)s'",
+ 'author-date-is-committer-date':
+ "Use the authors's date as the comitter's date, default is '%(author-date-is-committer-date)s'",
}
config_files = [ '/etc/git-buildpackage/gbp.conf',
os.path.expanduser('~/.gbp.conf'),
diff --git a/gbp/git.py b/gbp/git.py
index 8b7f17e4..3e599000 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -370,7 +370,8 @@ class GitRepository(object):
GitCommand("update-ref")(args)
def commit_tree(self, tree, msg, parents, author=None, email=None,
- date=None, commit_date=None):
+ date=None, committer_name=None, committer_email=None,
+ committer_date=None):
"""Commit a tree with commit msg 'msg' and parents 'parents'"""
extra_env = {}
if author:
@@ -379,8 +380,12 @@ class GitRepository(object):
extra_env['GIT_AUTHOR_EMAIL'] = email
if date:
extra_env['GIT_AUTHOR_DATE'] = date
- if commit_date:
- extra_env['GIT_COMMITTER_DATE'] = commit_date
+ if committer_name:
+ extra_env['GIT_COMMITTER_NAME'] = committer_name
+ if committer_email:
+ extra_env['GIT_COMMITTER_EMAIL'] = committer_email
+ if committer_date:
+ extra_env['GIT_COMMITTER_DATE'] = committer_date
args = [ tree ]
for parent in parents:
@@ -389,7 +394,9 @@ class GitRepository(object):
return sha1
def commit_dir(self, unpack_dir, msg, branch, other_parents=None,
- author = None, email = None, date = None, commit_date = None):
+ author = None, email = None, date = None,
+ committer_name = None, committer_email = None,
+ committer_date = None):
"""Replace the current tip of branch 'branch' with the contents from 'unpack_dir'
@param unpack_dir: content to add
@param msg: commit message to use
@@ -397,7 +404,10 @@ class GitRepository(object):
@param parents: additional parents of this commit
@param author: commit with author name 'author'
@param email: commit with author email 'email'
- @param date: set commit date to 'date'"""
+ @param date: set author date to 'date'
+ @param committer_author: commit with committer name 'commiter_name'
+ @param committer_email: commit with committer email 'commiter_email'
+ @param committer_date: set commit date to 'date'"""
self.__check_path()
git_index_file = os.path.join(self.path, '.git', 'gbp_index')
try:
@@ -427,7 +437,9 @@ class GitRepository(object):
commit = self.commit_tree(tree=tree, msg=msg, parents=parents,
author=author, email=email, date=date,
- commit_date=commit_date)
+ committer_name=committer_name,
+ committer_email=committer_email,
+ committer_date=committer_date)
if not commit:
raise GbpError, "Failed to commit tree"
self.update_ref("refs/heads/%s" % branch, commit, cur)
diff --git a/git-import-dsc b/git-import-dsc
index 0c56eda2..6503966a 100755
--- a/git-import-dsc
+++ b/git-import-dsc
@@ -110,7 +110,10 @@ def apply_debian_patch(repo, unpack_dir, src, options, parents):
author = author,
email = email,
date = date,
- commit_date = date)
+ committer_date = [None, date][options.author_committer_date],
+ committer_name = [None, author][options.author_committer],
+ committer_email = [None, email][options.author_committer],)
+
gitTag(build_tag(options.debian_tag, version),
msg="Debian release %s" % version, commit=commit)
except gbpc.CommandExecFailed:
@@ -195,6 +198,11 @@ def main(argv):
import_group.add_option("--allow-same-version", action="store_true",
dest="allow_same_version", default=False,
help="allow to import already imported version")
+ import_group.add_boolean_config_file_option(option_name="author-is-committer",
+ dest="author_committer")
+ import_group.add_boolean_config_file_option(option_name="author-date-is-committer-date",
+ dest="author_committer_date")
+
(options, args) = parser.parse_args(argv[1:])
gbp.log.setup(options.color, options.verbose)