Skip to contentSkip to conversation

patman: cover letter shows like 00/xx if more than 10 patches

PATCH New Josh Wu 2 participants 8 messages Mar 31, 2015 – Apr 8, 2015

lore
Share & tools
lore

Josh Wu

author
#0 lore raw

PATCH 1/1 patman: cover letter shows like 00/xx if more than 10 patches

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

---

 tools/patman/patchstream.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/patman/patchstream.py +7 -2
index 8c3a0ec..4bfb1e9 100644
@@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
     prefix = series.GetPatchPrefix()
     for line in lines:
         if line.startswith('Subject:'):
-            # TODO: if more than 10 patches this should save 00/xx, not 0/xx
-            line = 'Subject: [%s 0/%d] %s\n' % (prefix, count, text[0])
+            # if more than 10 patches this should save 00/xx, not 0/xx
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 1
+
+            zero = '0' * zero_repeat
+            line = 'Subject: [%s %s/%d] %s\n' % (prefix, zero, count, text[0])
 
         # Insert our cover letter
         elif line.startswith('*** BLURB HERE ***'):
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 patman: cover letter shows like 00/xx if more than 10 patches

Hi Josh,

Quoted 4 lines · Josh Wu

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

---

This is a quirk of patman that I've grown comfortable with. Still, we should fix it. Thanks for the patch.

Quoted 9 lines
 tools/patman/patchstream.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/patman/patchstream.py +0 -0
index 8c3a0ec..4bfb1e9 100644

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 471

Quoted 6 lines
tools/patman/patchstream.py +1 -2
@@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
     prefix = series.GetPatchPrefix()
     for line in lines:
         if line.startswith('Subject:'):
-            # TODO: if more than 10 patches this should save 00/xx, not 0/xx
-            line = 'Subject: [%s 0/%d] %s\n' % (prefix, count, text[0])
+            # if more than 10 patches this should save 00/xx, not 0/xx

s/save/say/

(my typo, I think)

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 474

Quoted 3 lines
tools/patman/patchstream.py +3 -0
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 1

How about:

zero_repeat = int(math.log10(count)) + 1

?

Quoted 8 lines
tools/patman/patchstream.py +3 -1
+
+            zero = '0' * zero_repeat
+            line = 'Subject: [%s %s/%d] %s\n' % (prefix, zero, count, text[0])
 
         # Insert our cover letter
         elif line.startswith('*** BLURB HERE ***'):
--

1.9.1

Regards,
Simon

author
#2 lore raw

PATCH 1/1 patman: cover letter shows like 00/xx if more than 10 patches

Hi, Simon

Quoted 26 lines · Simon Glass

Hi Josh,

Quoted 4 lines · Josh Wu

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

---

This is a quirk of patman that I've grown comfortable with. Still, we should fix it. Thanks for the patch.

Quoted 8 lines
  tools/patman/patchstream.py | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
tools/patman/patchstream.py +0 -0
index 8c3a0ec..4bfb1e9 100644

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 471

Quoted 6 lines
tools/patman/patchstream.py +1 -2
@@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
      prefix = series.GetPatchPrefix()
      for line in lines:
          if line.startswith('Subject:'):
-            # TODO: if more than 10 patches this should save 00/xx, not 0/xx
-            line = 'Subject: [%s 0/%d] %s\n' % (prefix, count, text[0])
+            # if more than 10 patches this should save 00/xx, not 0/xx

s/save/say/

Quoted 1 line

(my typo, I think)

;-) I'll fix this.

Quoted 9 lines

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 474

Quoted 4 lines
tools/patman/patchstream.py +3 -0
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 1

How about:

    zero_repeat = int(math.log10(count)) + 1

?

yes, it's better. just need to import the match lib. I will change to this and sent v2 patch. Thanks.

BTW: speak of patman, I get an issue of using the "Series-prefix".

When I use Series-prefix like following in the commit:
Series-prefix: U-Boot][
Then I get the patman generated patch like:
[U-Boot][ PATCH]
^ a space here.

A space is before the 'PATCH', that annoys me. But I don't see you have such space in your patches. Any advice to avoid the extra space? Thanks in advance.

Best Regards,
Josh Wu

Quoted 11 lines
Quoted 9 lines
tools/patman/patchstream.py +3 -1
+
+            zero = '0' * zero_repeat
+            line = 'Subject: [%s %s/%d] %s\n' % (prefix, zero, count, text[0])
 
          # Insert our cover letter
          elif line.startswith('*** BLURB HERE ***'):
--

1.9.1

Regards,
Simon

#3 lore raw

PATCH 1/1 patman: cover letter shows like 00/xx if more than 10 patches

Hi Josh,

Quoted 60 lines · Josh Wu

Hi, Simon

Quoted 31 lines · Simon Glass

Hi Josh,

Quoted 5 lines · Josh Wu

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

---

This is a quirk of patman that I've grown comfortable with. Still, we should fix it. Thanks for the patch.

Quoted 13 lines
  tools/patman/patchstream.py | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
tools/patman/patchstream.py +0 -1
index 8c3a0ec..4bfb1e9 100644
@@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
      prefix = series.GetPatchPrefix()
      for line in lines:
          if line.startswith('Subject:'):
-            # TODO: if more than 10 patches this should save 00/xx, not

0/xx

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 471

Quoted 2 lines
tools/patman/patchstream.py +1 -1
-            line = 'Subject: [%s 0/%d] %s\n' % (prefix, count, text[0])
+            # if more than 10 patches this should save 00/xx, not 0/xx

s/save/say/

Quoted 1 line

(my typo, I think)

;-) I'll fix this.

Quoted 11 lines

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 474

Quoted 5 lines
tools/patman/patchstream.py +3 -0
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 1

How about:

    zero_repeat = int(math.log10(count)) + 1

?

yes, it's better. just need to import the match lib. I will change to this and sent v2 patch. Thanks.

BTW: speak of patman, I get an issue of using the "Series-prefix".

When I use Series-prefix like following in the commit:
Series-prefix: U-Boot][
Then I get the patman generated patch like:
[U-Boot][ PATCH]
^ a space here.

Quoted 3 lines

A space is before the 'PATCH', that annoys me. But I don't see you have such space in your patches. Any advice to avoid the extra space? Thanks in advance.

This is intentional, since if you use a prefix of 'RFC' we want to get 'RFC PATCH v2' instead of 'RFCPATCH v2'. See GetPatchPrefix(). Why do you want [U-Boot] anyway? That sounds more like the project than a patch prefix. Perhaps you could add an option to prepend the project in square brackets?

Regards,
Simon

author
#4 lore raw

PATCH 1/1 patman: cover letter shows like 00/xx if more than 10 patches

HI, Simon

Thanks for the feedback.

Quoted 55 lines · Simon Glass

Hi Josh,

Quoted 52 lines · Josh Wu

Hi, Simon

Quoted 27 lines · Simon Glass

Hi Josh,

Quoted 4 lines · Josh Wu

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

---

This is a quirk of patman that I've grown comfortable with. Still, we should fix it. Thanks for the patch.

Quoted 13 lines
   tools/patman/patchstream.py | 9 +++++++--
   1 file changed, 7 insertions(+), 2 deletions(-)
tools/patman/patchstream.py +0 -1
index 8c3a0ec..4bfb1e9 100644
@@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
       prefix = series.GetPatchPrefix()
       for line in lines:
           if line.startswith('Subject:'):
-            # TODO: if more than 10 patches this should save 00/xx, not

0/xx

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 471

Quoted 2 lines
tools/patman/patchstream.py +1 -1
-            line = 'Subject: [%s 0/%d] %s\n' % (prefix, count, text[0])
+            # if more than 10 patches this should save 00/xx, not 0/xx

s/save/say/

Quoted 1 line

(my typo, I think)

;-) I'll fix this.

Quoted 9 lines

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 474

Quoted 4 lines
tools/patman/patchstream.py +3 -0
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 1

How about:

     zero_repeat = int(math.log10(count)) + 1

?

yes, it's better. just need to import the match lib. I will change to this and sent v2 patch. Thanks.

BTW: speak of patman, I get an issue of using the "Series-prefix".

When I use Series-prefix like following in the commit:
Series-prefix: U-Boot][
Then I get the patman generated patch like:
[U-Boot][ PATCH]
^ a space here.

Quoted 5 lines
Quoted 3 lines

A space is before the 'PATCH', that annoys me. But I don't see you have such space in your patches. Any advice to avoid the extra space? Thanks in advance.

This is intentional, since if you use a prefix of 'RFC' we want to get 'RFC PATCH v2' instead of 'RFCPATCH v2'. See GetPatchPrefix().

yes, understood.

Quoted 4 lines

Why do
you want [U-Boot] anyway? That sounds more like the project than a patch prefix. Perhaps you could add an option to prepend the project in square brackets?

I tried a the project prefix, and that works for the format-patch command. But it not work for patman.

here is my steps:
git config format.subjectprefix "U-Boot"

Now, when I run git format-patch, the generated patch will have "[U-Boot]" prefix. But if I run "patman -c1 -n", the [U-Boot] prefix is gone.
It seems patman overide the format.subjectprefix option of git. Do you have an idea about what is the difference between the run "git format-patch -1" and "patman -c1"?
thanks.

Best Regards,
Josh Wu

Quoted 3 lines

Regards,
Simon

#5 lore raw

PATCH 1/1 patman: cover letter shows like 00/xx if more than 10 patches

Hi Josh,

Quoted 94 lines · Josh Wu

HI, Simon

Thanks for the feedback.

Quoted 67 lines · Simon Glass

Hi Josh,

Quoted 63 lines · Josh Wu

Hi, Simon

Quoted 33 lines · Simon Glass

Hi Josh,

Quoted 5 lines · Josh Wu

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

---

This is a quirk of patman that I've grown comfortable with. Still, we should fix it. Thanks for the patch.

Quoted 12 lines
   tools/patman/patchstream.py | 9 +++++++--
   1 file changed, 7 insertions(+), 2 deletions(-)
tools/patman/patchstream.py +0 -1
index 8c3a0ec..4bfb1e9 100644
@@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
       prefix = series.GetPatchPrefix()
       for line in lines:
           if line.startswith('Subject:'):
-            # TODO: if more than 10 patches this should save 00/xx,
Quoted 5 lines

not
0/xx
- line = 'Subject: [%s 0/%d] %s\n' % (prefix, count,
text[0])
+ # if more than 10 patches this should save 00/xx, not 0/xx

s/save/say/

Quoted 1 line

(my typo, I think)

;-) I'll fix this.

Quoted 11 lines

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 474

Quoted 5 lines
tools/patman/patchstream.py +3 -0
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 1

How about:

     zero_repeat = int(math.log10(count)) + 1

?

yes, it's better. just need to import the match lib. I will change to this and sent v2 patch. Thanks.

BTW: speak of patman, I get an issue of using the "Series-prefix".

When I use Series-prefix like following in the commit:
Series-prefix: U-Boot][
Then I get the patman generated patch like:
[U-Boot][ PATCH]
^ a space here.

Quoted 7 lines
Quoted 4 lines

A space is before the 'PATCH', that annoys me. But I don't see you have such
space in your patches. Any advice to avoid the extra space? Thanks in advance.

This is intentional, since if you use a prefix of 'RFC' we want to get 'RFC PATCH v2' instead of 'RFCPATCH v2'. See GetPatchPrefix().

yes, understood.

Quoted 4 lines

Why do
you want [U-Boot] anyway? That sounds more like the project than a patch prefix. Perhaps you could add an option to prepend the project in square brackets?

I tried a the project prefix, and that works for the format-patch command. But it not work for patman.

here is my steps:
git config format.subjectprefix "U-Boot"

Quoted 6 lines

Now, when I run git format-patch, the generated patch will have "[U-Boot]" prefix. But if I run "patman -c1 -n", the [U-Boot] prefix is gone. It seems patman overide the format.subjectprefix option of git. Do you have an idea about what is the difference between the run "git format-patch -1" and "patman -c1"?
thanks.

Why do you want [U-Boot] anyway?

I suggest you add an option to prepend the patman project name (in square brackets) to patches, from the -p option.

Patman has to set up its own prefix when generating patches. See CreatePatches().

Regards,
Simon

author
#6 lore raw

PATCH 1/1 patman: cover letter shows like 00/xx if more than 10 patches

Quoted 84 lines · Simon Glass

Hi Josh,

Quoted 81 lines · Josh Wu

HI, Simon

Thanks for the feedback.

Quoted 57 lines · Simon Glass

Hi Josh,

Quoted 54 lines · Josh Wu

Hi, Simon

Quoted 29 lines · Simon Glass

Hi Josh,

Quoted 4 lines · Josh Wu

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

---

This is a quirk of patman that I've grown comfortable with. Still, we should fix it. Thanks for the patch.

Quoted 12 lines
    tools/patman/patchstream.py | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)
tools/patman/patchstream.py +0 -1
index 8c3a0ec..4bfb1e9 100644
@@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
        prefix = series.GetPatchPrefix()
        for line in lines:
            if line.startswith('Subject:'):
-            # TODO: if more than 10 patches this should save 00/xx,
Quoted 5 lines

not
0/xx
- line = 'Subject: [%s 0/%d] %s\n' % (prefix, count,
text[0])
+ # if more than 10 patches this should save 00/xx, not 0/xx

s/save/say/

Quoted 1 line

(my typo, I think)

;-) I'll fix this.

Quoted 9 lines

tools/patman/patchstream.py def InsertCoverLetter(fname, series, count): · line 474

Quoted 4 lines
tools/patman/patchstream.py +3 -0
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 1

How about:

      zero_repeat = int(math.log10(count)) + 1

?

yes, it's better. just need to import the match lib. I will change to this and sent v2 patch. Thanks.

BTW: speak of patman, I get an issue of using the "Series-prefix".

When I use Series-prefix like following in the commit:
Series-prefix: U-Boot][
Then I get the patman generated patch like:
[U-Boot][ PATCH]
^ a space here.

Quoted 6 lines
Quoted 4 lines

A space is before the 'PATCH', that annoys me. But I don't see you have such
space in your patches. Any advice to avoid the extra space? Thanks in advance.

This is intentional, since if you use a prefix of 'RFC' we want to get 'RFC PATCH v2' instead of 'RFCPATCH v2'. See GetPatchPrefix().

yes, understood.

Quoted 4 lines

Why do
you want [U-Boot] anyway? That sounds more like the project than a patch prefix. Perhaps you could add an option to prepend the project in square brackets?

I tried a the project prefix, and that works for the format-patch command. But it not work for patman.

here is my steps:
git config format.subjectprefix "U-Boot"

Quoted 7 lines
Quoted 6 lines

Now, when I run git format-patch, the generated patch will have "[U-Boot]" prefix. But if I run "patman -c1 -n", the [U-Boot] prefix is gone. It seems patman overide the format.subjectprefix option of git. Do you have an idea about what is the difference between the run "git format-patch -1" and "patman -c1"?
thanks.

Why do you want [U-Boot] anyway?

I always send the u-boot patch with title like "[U-Boot][PATCH]xxxxx". Is "[U-Boot]" string not needed?

Quoted 3 lines

I suggest you add an option to prepend the patman project name (in square brackets) to patches, from the -p option.

hmm, it's better to get the prefix by 'git config format.subjectprefix', then add this to CreatePatches().

Quoted 3 lines

Patman has to set up its own prefix when generating patches. See CreatePatches().

okay, I'll try this, if it works nice then I will send a patch out.

Thanks a lot.
Best Regards,
Josh Wu

Quoted 3 lines

Regards,
Simon

#7 lore raw

PATCH 1/1 patman: cover letter shows like 00/xx if more than 10 patches

Hi Josh,

Quoted 108 lines · Josh Wu
Quoted 106 lines · Simon Glass

Hi Josh,

Quoted 101 lines · Josh Wu

HI, Simon

Thanks for the feedback.

Quoted 67 lines · Simon Glass

Hi Josh,

Quoted 63 lines · Josh Wu

Hi, Simon

Quoted 33 lines · Simon Glass

Hi Josh,

Quoted 5 lines · Josh Wu

Make cover letter shows like 0/x, 00/xx and 000/xxx etc.

---

This is a quirk of patman that I've grown comfortable with. Still, we should fix it. Thanks for the patch.

Quoted 12 lines
    tools/patman/patchstream.py | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)
tools/patman/patchstream.py +0 -1
index 8c3a0ec..4bfb1e9 100644
@@ -468,8 +468,13 @@ def InsertCoverLetter(fname, series, count):
        prefix = series.GetPatchPrefix()
        for line in lines:
            if line.startswith('Subject:'):
-            # TODO: if more than 10 patches this should save 00/xx,
Quoted 5 lines

not
0/xx
- line = 'Subject: [%s 0/%d] %s\n' % (prefix, count,
text[0])
+ # if more than 10 patches this should save 00/xx, not 0/xx

s/save/say/

Quoted 1 line

(my typo, I think)

;-) I'll fix this.

Quoted 11 lines

tools/patman/patchstream.py

Quoted 5 lines
tools/patman/patchstream.py +3 -0
+            zero_repeat = 1
+            while (count / (10 ** zero_repeat) > 0):
+                zero_repeat = zero_repeat + 1

How about:

      zero_repeat = int(math.log10(count)) + 1

?

yes, it's better. just need to import the match lib. I will change to this and sent v2 patch. Thanks.

BTW: speak of patman, I get an issue of using the "Series-prefix".

When I use Series-prefix like following in the commit:
Series-prefix: U-Boot][
Then I get the patman generated patch like:
[U-Boot][ PATCH]
^ a space here.

Quoted 7 lines
Quoted 4 lines

A space is before the 'PATCH', that annoys me. But I don't see you have such
space in your patches. Any advice to avoid the extra space? Thanks in advance.

This is intentional, since if you use a prefix of 'RFC' we want to get 'RFC PATCH v2' instead of 'RFCPATCH v2'. See GetPatchPrefix().

yes, understood.

Quoted 4 lines

Why do
you want [U-Boot] anyway? That sounds more like the project than a patch prefix. Perhaps you could add an option to prepend the project in square brackets?

I tried a the project prefix, and that works for the format-patch command. But it not work for patman.

here is my steps:
git config format.subjectprefix "U-Boot"

Now, when I run git format-patch, the generated patch will have "[U-Boot]" prefix. But if I run "patman -c1 -n", the [U-Boot] prefix is gone. It seems patman overide the format.subjectprefix option of git. Do you have an idea about what is the difference between the run "git format-patch -1" and "patman -c1"?
thanks.

Quoted 4 lines
Quoted 1 line

Why do you want [U-Boot] anyway?

I always send the u-boot patch with title like "[U-Boot][PATCH]xxxxx". Is "[U-Boot]" string not needed?

Nope.

Quoted 6 lines
Quoted 4 lines

I suggest you add an option to prepend the patman project name (in square brackets) to patches, from the -p option.

hmm, it's better to get the prefix by 'git config format.subjectprefix', then add this to CreatePatches().

You could certainly do that.

Quoted 8 lines
Quoted 4 lines

Patman has to set up its own prefix when generating patches. See CreatePatches().

okay, I'll try this, if it works nice then I will send a patch out.

Thanks a lot.

OK sounds good.

Regards,
Simon