commit:     db7779a27f6f1b8c54e74adae98a25ca9fff66f3
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 13 17:33:19 2017 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sat Jan 14 14:21:33 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=db7779a2

repoman: remove extra blank line in commit footer

This results in cleaner/more compact commit messages when the author has
already included some "Field: value" pair in the commit message body.

This check simply looks for a colon in the last line of the commit
message body.

Before:
  dev-libs/libfoo: fix something

  Yada yada yada.

  Gentoo-Bug: 123

  Package-Manager: Portage-2.3.3, Repoman-2.3.1

After:
  dev-libs/libfoo: fix something

  Yada yada yada.

  Gentoo-Bug: 123
  Package-Manager: Portage-2.3.3, Repoman-2.3.1

 repoman/pym/repoman/actions.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
index 189580e..58b00d4 100644
--- a/repoman/pym/repoman/actions.py
+++ b/repoman/pym/repoman/actions.py
@@ -128,6 +128,10 @@ class Actions(object):
                                        myupdates, mymanifests, myremoved, 
mychanged, myautoadd,
                                        mynew, commitmessage)
 
+               lastline = commitmessage.splitlines()[-1]
+               if not ':' in lastline:
+                       commitmessage += '\n'
+
                commit_footer = self.get_commit_footer()
                commitmessage += commit_footer
 
@@ -337,7 +341,7 @@ class Actions(object):
                        portage_version = "Unknown"
                # Use new footer only for git (see bug #438364).
                if self.vcs_settings.vcs in ["git"]:
-                       commit_footer = "\n\nPackage-Manager: Portage-%s, 
Repoman-%s" % (
+                       commit_footer = "\nPackage-Manager: Portage-%s, 
Repoman-%s" % (
                                                        portage.VERSION, 
VERSION)
                        if report_options:
                                commit_footer += "\nRepoMan-Options: " + " 
".join(report_options)
@@ -351,7 +355,7 @@ class Actions(object):
                                unameout += platform.processor()
                        else:
                                unameout += platform.machine()
-                       commit_footer = "\n\n"
+                       commit_footer = "\n"
                        if dco_sob:
                                commit_footer += "Signed-off-by: %s\n" % 
(dco_sob, )
                        commit_footer += "(Portage version: %s/%s/%s" % \

Reply via email to