public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/3] patman: Add option to suppress empty changelog entries
Date: Mon, 13 Apr 2020 17:51:24 -0400	[thread overview]
Message-ID: <20200413215126.548213-2-seanga2@gmail.com> (raw)
In-Reply-To: <20200413215126.548213-1-seanga2@gmail.com>

Patman outputs a line for every edition of the series in every patch,
regardless of whether any changes were made. This can result in many
redundant lines in patch changelogs, especially when a patch did not exist
before a certain revision. For example, the existing behaviour could result
in a changelog of

Changes in v7: None
Changes in v6: None
Changes in v5:
- Make a change

Changes in v4: None

Changes in v3:
- New

Changes in v2: None

With this patch applied and with --no-empty-changes, the same patch would
look like

(no changes since v5)

Changes in v5:
- Make a change

Changes in v3:
- New

This is entirely aesthetic, but I think it reduces clutter, especially for
patches added later on in a series.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v2:
- Add a note when there are no changes in the current revision
- Make this the default behaviour, and remove the option

 tools/patman/patchstream.py |  2 +-
 tools/patman/series.py      | 40 +++++++++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index df3eb7483b..a83497d79f 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -340,7 +340,7 @@ class PatchStream:
             elif line == '---':
                 self.state = STATE_DIFFS
 
-                # Output the tags (signeoff first), then change list
+                # Output the tags (signoff first), then change list
                 out = []
                 log = self.series.MakeChangeLog(self.commit)
                 out += [line]
diff --git a/tools/patman/series.py b/tools/patman/series.py
index a15f7625ed..ca42e5e966 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -146,38 +146,56 @@ class Series(dict):
             Changes in v4:
             - Jog the dial back closer to the widget
 
-            Changes in v3: None
             Changes in v2:
             - Fix the widget
             - Jog the dial
 
-            etc.
+            If there are no new changes in a patch, a note will be added
+
+            (no changes since v2)
+
+            Changes in v2:
+            - Fix the widget
+            - Jog the dial
         """
+        versions = sorted(self.changes, reverse=True)
+        newest_version = 1
+        try:
+            newest_version = max(int(self.version), versions[0])
+        except (IndexError, ValueError):
+            pass
+
         final = []
         process_it = self.get('process_log', '').split(',')
         process_it = [item.strip() for item in process_it]
         need_blank = False
-        for change in sorted(self.changes, reverse=True):
+        for version in versions:
             out = []
-            for this_commit, text in self.changes[change]:
+            for this_commit, text in self.changes[version]:
                 if commit and this_commit != commit:
                     continue
                 if 'uniq' not in process_it or text not in out:
                     out.append(text)
-            line = 'Changes in v%d:' % change
-            have_changes = len(out) > 0
             if 'sort' in process_it:
                 out = sorted(out)
+            have_changes = len(out) > 0
+            line = 'Changes in v%d:' % version
             if have_changes:
                 out.insert(0, line)
-            else:
-                out = [line + ' None']
-            if need_blank:
-                out.insert(0, '')
+                if version < newest_version:
+                    out.insert(0, '')
+                    out.insert(0, '(no changes since v%d)' % version)
+                    newest_version = 0
+                # Only add a new line if we output something
+                if need_blank:
+                    out.insert(0, '')
             final += out
             need_blank = have_changes
-        if self.changes:
+
+        if len(final) > 0:
             final.append('')
+        else:
+            final = ['(no changes since v1)', '']
         return final
 
     def DoChecks(self):
-- 
2.25.1

  reply	other threads:[~2020-04-13 21:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 21:51 [PATCH v2 0/3] patman: Add changelog customization options Sean Anderson
2020-04-13 21:51 ` Sean Anderson [this message]
2020-04-19 23:37   ` [PATCH v2 1/3] patman: Add option to suppress empty changelog entries Simon Glass
2020-04-13 21:51 ` [PATCH v2 2/3] patman: Add new tags for finer-grained changelog control Sean Anderson
2020-04-13 21:51 ` [PATCH v2 3/3] patman: Support multi-line changes in changelogs Sean Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200413215126.548213-2-seanga2@gmail.com \
    --to=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox