[SCM] Git repository for devscripts branch, jessie, updated. v2.12.4-38-g9c70dd2

Christoph Berg myon at debian.org
Sun Nov 25 15:59:34 UTC 2012


The following commit has been merged in the jessie branch:
commit 9c70dd2a0e9a83f4788c4bb263650494f5e82428
Author: Christoph Berg <myon at debian.org>
Date:   Sun Nov 25 16:59:25 2012 +0100

    debchange: --changelog-info will pass --author and --date for git commits.

diff --git a/debian/changelog b/debian/changelog
index 2fdcb84..b1c13d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ devscripts (2.12.5+exp1) UNRELEASED; urgency=low
   [ Christoph Berg ]
   * origtargz: New script: fetch the orig tarball of a Debian package from
     various sources, and unpack it
+  * debchange: --changelog-info will pass --author and --date for git commits.
 
   [ James McCoy ]
   * licensecheck: Recognize MPL 2.0 licenses.  Thanks to Ryan Pavlik for the
diff --git a/scripts/debcommit.pl b/scripts/debcommit.pl
index ccef0fa..e089dcd 100755
--- a/scripts/debcommit.pl
+++ b/scripts/debcommit.pl
@@ -205,6 +205,8 @@ Options:
    --no-strip-message  Do not strip a leading '* ' (default)
    --sign-tags         Enable signing of tags (git only)
    --no-sign-tags      Do not sign tags (default)
+   --changelog-info    Use author and date information from the changelog
+                       for the commit (git only)
    -h --help           This message
    -v --version        Version information
 
@@ -239,8 +241,9 @@ my $all=0;
 my $stripmessage=1;
 my $signtags=0;
 my $changelog;
+my $changelog_info=0;
 my $keyid;
-my $version;
+my ($version, $date, $maintainer);
 my $onlydebian=0;
 
 # Now start by reading configuration files and then command line
@@ -318,6 +321,7 @@ if (! GetOptions(
 		 "c|changelog=s" => \$changelog,
 		 "s|strip-message!" => \$stripmessage,
 		 "sign-tags!" => \$signtags,
+		 "changelog-info!" => \$changelog_info,
 		 "R|release-use-changelog!" => \$release_use_changelog,
 		 "h|help" => sub { usage(); exit 0; },
 		 "v|version" => sub { version(); exit 0; },
@@ -368,11 +372,27 @@ if ($release) {
 	close C;
 
 	$version=`dpkg-parsechangelog -l\Q$changelog\E | grep '^Version:' | cut -f 2 -d ' '`;
-	chomp $version;
     }
 
     $message="releasing version $version" if ! defined $message;
 }
+if ($changelog_info) {
+    eval {
+	require Dpkg::Changelog::Parse;
+    };
+    if (not $@) {
+	# dpkg >= 1.15.5.2
+	my $log = Dpkg::Changelog::Parse::changelog_parse(file => $changelog);
+	$maintainer = $log->{Maintainer};
+	$date = $log->{Date};
+    }
+    else {
+	$maintainer=`dpkg-parsechangelog -l\Q$changelog\E | grep '^Maintainer:' | cut -f 2- -d ' '`;
+	chomp $maintainer;
+	$date=`dpkg-parsechangelog -l\Q$changelog\E | grep '^Date:' | cut -f 2- -d ' '`;
+	chomp $date;
+    }
+}
 if ($edit) {
     my $modified = 0;
     ($message, $modified) = edit($message);
@@ -547,7 +567,11 @@ sub commit {
 	    if ($all) {
 		@files_to_commit=("-a")
 	    }
-	    $action_rc = action($prog, "commit", "-m", $message, @files_to_commit);
+	    my @extra_args = ();
+	    if ($changelog_info and $prog eq 'git') { # --use-author
+		@extra_args = ("--author=$maintainer", "--date=$date");
+	    }
+	    $action_rc = action($prog, "commit", "-m", $message, @extra_args, @files_to_commit);
 	}
     }
     elsif ($prog eq 'tla' || $prog eq 'baz') {

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list