Skip to contentSkip to conversation

Some patman fixes

PATCH New Ilya Yanok 3 participants 10 messages Aug 7, 2012 – Oct 2, 2012

lore
Share & tools
lore

Ilya Yanok

author
#0 lore raw

cover Some patman fixes

Patman is the great tool but I've found it nearly unusable for me. First of all I need to work with multiple signoffs in commits, then I'd like to use multiline changelog entries and I accostomed to putting changelog enties to the bottom of the commit.

These patches fix changelog processing and disables additional signoff and changelog processing.

Ilya Yanok (4):
patman: fix end of changes detection
patman: don't pick changes while processing patches
patman: don't mess with changelog
patman: don't mess with signoffs

 tools/patman/patchstream.py |   22 ++++++++++------------
 tools/patman/series.py      |    5 ++---
 2 files changed, 12 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/4 patman: fix end of changes detection

Changes may end in '---' line or Signoff line (generated by git format-patch) in case of Series-changes: lines being the last ones in commit message. So detect it properly.

---
 tools/patman/patchstream.py |    6 ++++++
 1 file changed, 6 insertions(+)
tools/patman/patchstream.py +6 -0
index be40af3..036b129 100644
@@ -36,6 +36,9 @@ re_remove = re.compile('^BUG=|^TEST=|^Change-Id:|^Review URL:'
 # Lines which are allowed after a TEST= line
 re_allowed_after_test = re.compile('^Signed-off-by:')
 
+# Signoffs
+re_signoff = re.compile('^Signed-off-by:')
+
 # The start of the cover letter
 re_cover = re.compile('^Cover-letter:')
 
@@ -207,6 +210,9 @@ class PatchStream:
             if is_blank:
                 # Blank line ends this change list
                 self.in_change = 0
+            elif line == '---' or re_signoff.match(line):
+                self.in_change = 0
+                out = self.ProcessLine(line)
             else:
                 self.series.AddChange(self.in_change, self.commit, line)
             self.skip_blank = False
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/4 patman: fix end of changes detection

Dear Ilya Yanok,

Quoted 8 lines · In message <[email protected]>…

Changes may end in '---' line or Signoff line (generated by git format-patch) in case of Series-changes: lines being the last ones in commit message. So detect it properly.

---
 tools/patman/patchstream.py |    6 ++++++
 1 file changed, 6 insertions(+)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The more we disagree, the more chance there is that at least  one  of
us is right.
author
#3 lore raw

PATCH 2/4 patman: don't pick changes while processing patches

In reply to Ilya Yanok

We already got all changes from git log output and the comment to the ProcessLine function clearly states that 'patch' mode is not for scanning tags.

---
 tools/patman/patchstream.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/patman/patchstream.py +2 -1
index 036b129..3de32d5 100644
@@ -214,7 +214,8 @@ class PatchStream:
                 self.in_change = 0
                 out = self.ProcessLine(line)
             else:
-                self.series.AddChange(self.in_change, self.commit, line)
+                if self.is_log:
+                    self.series.AddChange(self.in_change, self.commit, line)
             self.skip_blank = False
 
         # Detect Series-xxx tags
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 2/4 patman: don't pick changes while processing patches

Dear Ilya Yanok,

Quoted 8 lines · In message <[email protected]>…

We already got all changes from git log output and the comment to the ProcessLine function clearly states that 'patch' mode is not for scanning tags.

---
 tools/patman/patchstream.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The only way you could make a happy  marriage  is  by  cuttin'  their
heads  off  as  soon  as  they say `I do', yes? You can't make happi-
ness...                           - Terry Pratchett, _Witches Abroad_
author
#5 lore raw

PATCH 3/4 patman: don't mess with changelog

In reply to Ilya Yanok

Don't try to sort and uniq changelog entries as this breaks multiline entries. It will be better to add some real multi-line support but for now just preserve the entries as is.

---
 tools/patman/series.py |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
tools/patman/series.py +2 -3
index 05d9e73..4e7cb71 100644
@@ -154,10 +154,9 @@ class Series(dict):
             for this_commit, text in self.changes[change]:
                 if commit and this_commit != commit:
                     continue
-                if text not in out:
-                    out.append(text)
+                out.append(text)
             if out:
-                out = ['Changes in v%d:' % change] + sorted(out)
+                out = ['Changes in v%d:' % change] + out
                 if need_blank:
                     out = [''] + out
                 final += out
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 3/4 patman: don't mess with changelog

Dear Ilya Yanok,

Quoted 8 lines · In message <[email protected]>…

Don't try to sort and uniq changelog entries as this breaks multiline entries. It will be better to add some real multi-line support but for now just preserve the entries as is.

---
 tools/patman/series.py |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All this doesn't alter anything, you know. The world is still full of
stupid people. They don't use their brains. They don't seem  to  want
to think straight.                    - Terry Pratchett, _Soul Music_
author
#7 lore raw

PATCH 4/4 patman: don't mess with signoffs

In reply to Ilya Yanok

Currently patman assumes that there should be only one Signoff line and this is obviously incorrect: we often have to work with patches containing other people signoffs. Moreover, it's really desirable to preserve the comments between signoffs.

So until some sophisticated signoff processing will be developed I suggest just don't mess with signoffs at all and treat them like plain text lines. The only drawback I've found so far is the case where you have a patch with someones else signoff but not yours and also have to patman tags under signoff line. In this case you will get extra empty line between signoffs.

---
 tools/patman/patchstream.py |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
tools/patman/patchstream.py +2 -11
index 3de32d5..0503bac 100644
@@ -46,7 +46,7 @@ re_cover = re.compile('^Cover-letter:')
 re_series = re.compile('^Series-(\w*): *(.*)')
 
 # Commit tags that we want to collect and keep
-re_tag = re.compile('^(Tested-by|Acked-by|Signed-off-by|Cc): (.*)')
+re_tag = re.compile('^(Tested-by|Acked-by|Cc): (.*)')
 
 # The start of a new commit in the git log
 re_commit = re.compile('^commit (.*)')
@@ -241,15 +241,8 @@ class PatchStream:
 
         # Detect tags in the commit message
         elif tag_match:
-            # Onlly allow a single signoff tag
-            if tag_match.group(1) == 'Signed-off-by':
-                if self.signoff:
-                    self.warn.append('Patch has more than one Signed-off-by '
-                            'tag')
-                self.signoff += [line]
-
             # Remove Tested-by self, since few will take much notice
-            elif (tag_match.group(1) == 'Tested-by' and
+            if (tag_match.group(1) == 'Tested-by' and
                     tag_match.group(2).find(os.getenv('USER') + '@') != -1):
                 self.warn.append("Ignoring %s" % line)
             elif tag_match.group(1) == 'Cc':
@@ -288,8 +281,6 @@ class PatchStream:
 
                 # Output the tags (signeoff first), then change list
                 out = []
-                if self.signoff:
-                    out += self.signoff
                 log = self.series.MakeChangeLog(self.commit)
                 out += self.FormatTags(self.tags)
                 out += [line] + log
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 4/4 patman: don't mess with signoffs

Dear Ilya Yanok,

Quoted 12 lines · In message <[email protected]>…

Currently patman assumes that there should be only one Signoff line and this is obviously incorrect: we often have to work with patches containing other people signoffs. Moreover, it's really desirable to preserve the comments between signoffs.

So until some sophisticated signoff processing will be developed I suggest just don't mess with signoffs at all and treat them like plain text lines. The only drawback I've found so far is the case where you have a patch with someones else signoff but not yours and also have to patman tags under signoff line. In this case you will get extra empty line between signoffs.

Quoted 4 lines
---
 tools/patman/patchstream.py |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Evil does seek to maintain power by suppressing the truth."
"Or by misleading the innocent."
	-- Spock and McCoy, "And The Children Shall Lead",
	   stardate 5029.5.
#9 lore raw

cover Some patman fixes

In reply to Ilya Yanok

Hi,

Quoted 5 lines · Ilya Yanok

Patman is the great tool but I've found it nearly unusable for me. First of all I need to work with multiple signoffs in commits, then I'd like to use multiline changelog entries and I accostomed to putting changelog enties to the bottom of the commit.

I do wonder whether there should at least be options to sort/uniq entries and use the 'one line' format. I try to keep the changelog to a single line for each thing I change, and the merging that happens in the cover letter is useful, I think.

Regards,
Simon

Quoted 21 lines

These patches fix changelog processing and disables additional signoff and changelog processing.

Ilya Yanok (4):
patman: fix end of changes detection
patman: don't pick changes while processing patches
patman: don't mess with changelog
patman: don't mess with signoffs

 tools/patman/patchstream.py |   22 ++++++++++------------
 tools/patman/series.py      |    5 ++---
 2 files changed, 12 insertions(+), 15 deletions(-)

--
1.7.9.5

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot