[devscripts] 03/06: dch: Elide command-line message if it is empty

James McCoy jamessan at debian.org
Sat Jul 8 19:15:32 UTC 2017


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit f4f35850aaaf42bfe00a90244653dcfb7c499150
Author: James McCoy <jamessan at debian.org>
Date:   Sat Jul 8 14:13:37 2017 -0400

    dch: Elide command-line message if it is empty
    
    Many dch options (e.g., --bpo) automatically add their own entry to the
    changelog as well as adding a bullet for a subsequent entry.  If the
    user provides an empty message on the command-line, do not add the
    second bullet.
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog     |  4 ++++
 scripts/debchange.pl |  2 +-
 test/test_debchange  | 27 ++++++++++++++++++++++++++-
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 795bbba..aeb80e1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -45,6 +45,10 @@ devscripts (2.17.7) UNRELEASED; urgency=medium
   * bts:
     + Create the cache directory if it doesn't already exist.  Thanks to
       Joonas Kylmälä for the patch.  (Closes: #866117)
+  * debchange:
+    + When an empty message is provided on the command-line, do not add an
+      empty entry to the changelog.  Thanks to Adam Barratt for the patch.
+      (Closes: #830968)
 
   [ Ben Finney ]
   * debdiff:
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index 0c59d0e..b44b963 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -1253,7 +1253,7 @@ if (($opt_i || $opt_n || $opt_bn || $opt_qa || $opt_R || $opt_s || $opt_team ||
 	    print O "  * Rebuild for $bpo_dist.\n";
 	    $line = 1;
 	}
-	if (@closes_text or $TEXT) {
+	if (@closes_text or $TEXT or $EMPTY_TEXT) {
 	    foreach (@closes_text) { format_line($_, 1); }
 	    if (length $TEXT) { format_line($TEXT, 1); }
 	} elsif ($opt_news) {
diff --git a/test/test_debchange b/test/test_debchange
index 04b96a6..8cd609f 100755
--- a/test/test_debchange
+++ b/test/test_debchange
@@ -164,8 +164,33 @@ testEncoding() {
     success "-s \"Security upload\""
     verifyMaintainer "dch -s"
 
-    success "--bpo \"Backporrts upload\""
+    success "--bpo \"Backports upload\""
     verifyMaintainer "dch --bpo"
 }
 
+verifyEntryLines() {
+    success "$1"
+    local changes="$(dpkg-parsechangelog -l"$CHANGELOG" -SChanges | fgrep '*')"
+    assertEquals "\"$changes\"" 1 "$(echo "$changes" | wc -l)"
+}
+
+# Any options which automatically add their own entry to the changelog should
+# elide an empty entry if the user passes an empty string as the entry.
+testEmptyMessage() {
+    rm -f "$CHANGELOG"
+    success "--create -D unstable --package test-package -v 1.0-1 'First upload'"
+
+    verifyEntryLines "--nmu ''"
+
+    verifyEntryLines "--bin-nmu ''"
+
+    verifyEntryLines "--qa ''"
+
+    verifyEntryLines "--security ''"
+
+    verifyEntryLines "--bpo ''"
+
+    verifyEntryLines "--team ''"
+}
+
 . shunit2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list