All of lore.kernel.org
 help / color / mirror / Atom feed
* [patchwork][PATCH] patchwork.models: Include first patch's name in series name
@ 2016-11-24 23:00 Jose Lamego
  2016-11-30 17:14 ` [patchwork][PATCH v2] patchwork/models: " Jose Lamego
  2016-11-30 21:40 ` [patchwork][PATCH v3] patchwork.models: " Jose Lamego
  0 siblings, 2 replies; 6+ messages in thread
From: Jose Lamego @ 2016-11-24 23:00 UTC (permalink / raw)
  To: yocto

Patch Series created without a cover letter are named using a
non-descriptive generic string.

This change names the series using the first 30 characters in
patch #1 and the remaining patches number.

[Yocto #10625]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 patchwork/models.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/patchwork/models.py b/patchwork/models.py
index 3f531e6..fecf5cc 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series):
 def _on_revision_complete(sender, revision, **kwargs):
     series = revision.series
 
+    # Now we know how many patches are in the revision,
+    # so we can update the name for series without a cover letter
+    if series.name == SERIES_DEFAULT_NAME:
+        try:
+            name = series.latest_revision().ordered_patches()[0].name
+            n = re.compile(r'(\[\d+\/\d+\]\s?)')
+            name = n.sub('', name)
+            c = len(series.latest_revision().ordered_patches()) - 1
+            series.name = "\"%s...\" and %s more" % (name[:30],
+                          c)
+        except:
+            pass
+
     # update series.last_revision
     series.last_revision = series.latest_revision()
     series.save()
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patchwork][PATCH v2] patchwork/models: Include first patch's name in series name
  2016-11-24 23:00 [patchwork][PATCH] patchwork.models: Include first patch's name in series name Jose Lamego
@ 2016-11-30 17:14 ` Jose Lamego
  2016-11-30 21:40 ` [patchwork][PATCH v3] patchwork.models: " Jose Lamego
  1 sibling, 0 replies; 6+ messages in thread
From: Jose Lamego @ 2016-11-30 17:14 UTC (permalink / raw)
  To: yocto

Patch Series created without a cover letter are named using a
non-descriptive generic string.

This change names the series using either the first 30 characters in
patch #1 plus the remaining patches number, or the patch name for
one-patch (1/1) series.

[Yocto #10625]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 patchwork/models.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/patchwork/models.py b/patchwork/models.py
index 3f531e6..2dfd884 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -1042,6 +1042,22 @@ def _series_supersede_previous_patches(series):
 def _on_revision_complete(sender, revision, **kwargs):
     series = revision.series
 
+    # Now we know how many patches are in the revision,
+    # so we can update the name for series without a cover letter
+    if series.name == SERIES_DEFAULT_NAME:
+        try:
+            name = series.latest_revision().ordered_patches()[0].name
+            n = re.compile(r'(\[\d+\/\d+\]\s?)')
+            name = n.sub('', name)
+            c = len(series.latest_revision().ordered_patches())
+            # For one-patch series (1/1) without cover letter
+            if c == 1:
+                series.name = name
+            else:
+                series.name = "\"%s...\" and %s more" % (name[:30], c-1)
+        except:
+            pass
+
     # update series.last_revision
     series.last_revision = series.latest_revision()
     series.save()
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patchwork][PATCH v3] patchwork.models: Include first patch's name in series name
  2016-11-24 23:00 [patchwork][PATCH] patchwork.models: Include first patch's name in series name Jose Lamego
  2016-11-30 17:14 ` [patchwork][PATCH v2] patchwork/models: " Jose Lamego
@ 2016-11-30 21:40 ` Jose Lamego
  2016-12-02 20:29   ` [patchwork][PATCH v4] " Jose Lamego
  1 sibling, 1 reply; 6+ messages in thread
From: Jose Lamego @ 2016-11-30 21:40 UTC (permalink / raw)
  To: yocto

Patch Series created without a cover letter are named using a
non-descriptive generic string.

This change names the series using either the first 30 characters in
patch #1 plus the remaining patches number, or the patch name for
one-patch (1/1) series.

[YOCTO #10625]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 patchwork/models.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/patchwork/models.py b/patchwork/models.py
index 3f531e6..1521641 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series):
 def _on_revision_complete(sender, revision, **kwargs):
     series = revision.series
 
+    # Now we know how many patches are in the revision,
+    # so we can update the name for series without a cover letter
+    if series.name == SERIES_DEFAULT_NAME:
+        name = series.latest_revision().ordered_patches()[0].name
+        n = re.compile(r'(\[\d+\/\d+\]\s?)')
+        name = n.sub('', name)
+        c = len(series.latest_revision().ordered_patches())
+        # For one-patch series (1/1) without cover letter
+        if c == 1:
+            series.name = name
+        else:
+            series.name = "\"%s...\" and %s more" % (name[:30], c-1)
+
     # update series.last_revision
     series.last_revision = series.latest_revision()
     series.save()
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patchwork][PATCH v4] patchwork.models: Include first patch's name in series name
  2016-11-30 21:40 ` [patchwork][PATCH v3] patchwork.models: " Jose Lamego
@ 2016-12-02 20:29   ` Jose Lamego
  2016-12-05  8:30     ` Patrick Ohly
  0 siblings, 1 reply; 6+ messages in thread
From: Jose Lamego @ 2016-12-02 20:29 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 1429 bytes --]

Patch Series created without a cover letter are named using a
non-descriptive generic string.

This change names the series using either the first 30 characters in
patch #1 plus the remaining patches number, or the patch name for
one-patch (1/1) series.

[YOCTO #10625]

Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
---
 patchwork/models.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/patchwork/models.py b/patchwork/models.py
index 3f531e6..1521641 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series):
 def _on_revision_complete(sender, revision, **kwargs):
     series = revision.series

+    # Now we know how many patches are in the revision,
+    # so we can update the name for series without a cover letter
+    if series.name == SERIES_DEFAULT_NAME:
+        name = series.latest_revision().ordered_patches()[0].name
+        n = re.compile(r'(\[\d+\/\d+\]\s?)')
+        name = n.sub('', name)
+        c = len(series.latest_revision().ordered_patches())
+        # For one-patch series (1/1) without cover letter
+        if c == 1:
+            series.name = name
+        elif c > 1:
+            series.name = "\"%s...\" and %s more" % (name[:30], c-1)
+
     # update series.last_revision
     series.last_revision = series.latest_revision()
     series.save()


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [patchwork][PATCH v4] patchwork.models: Include first patch's name in series name
  2016-12-02 20:29   ` [patchwork][PATCH v4] " Jose Lamego
@ 2016-12-05  8:30     ` Patrick Ohly
  2016-12-05 14:07       ` Jose Lamego
  0 siblings, 1 reply; 6+ messages in thread
From: Patrick Ohly @ 2016-12-05  8:30 UTC (permalink / raw)
  To: Jose Lamego; +Cc: yocto

On Fri, 2016-12-02 at 14:29 -0600, Jose Lamego wrote:
> Patch Series created without a cover letter are named using a
> non-descriptive generic string.
> 
> This change names the series using either the first 30 characters in
> patch #1 plus the remaining patches number, or the patch name for
> one-patch (1/1) series.
> 
> [YOCTO #10625]
> 
> Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
> ---
>  patchwork/models.py | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

When you send different versions of your patches, can you include a
revision history? Otherwise, it's hard to see what changes between the
different iterations.

git notes can be used for that for single-commit changes. See "git
format-patch --notes" and "git notes".

> diff --git a/patchwork/models.py b/patchwork/models.py
> index 3f531e6..1521641 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series):
>  def _on_revision_complete(sender, revision, **kwargs):
>      series = revision.series
> 
> +    # Now we know how many patches are in the revision,
> +    # so we can update the name for series without a cover letter
> +    if series.name == SERIES_DEFAULT_NAME:
> +        name = series.latest_revision().ordered_patches()[0].name
> +        n = re.compile(r'(\[\d+\/\d+\]\s?)')
> +        name = n.sub('', name)
> +        c = len(series.latest_revision().ordered_patches())
> +        # For one-patch series (1/1) without cover letter
> +        if c == 1:
> +            series.name = name
> +        elif c > 1:
> +            series.name = "\"%s...\" and %s more" % (name[:30], c-1)
> +
>      # update series.last_revision
>      series.last_revision = series.latest_revision()
>      series.save()

Looks reasonable to me, but I don't really know the code. Were you
testing this and noticed cases with c == 0, i.e. cases where the last
series,name change didn't make sense?

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patchwork][PATCH v4] patchwork.models: Include first patch's name in series name
  2016-12-05  8:30     ` Patrick Ohly
@ 2016-12-05 14:07       ` Jose Lamego
  0 siblings, 0 replies; 6+ messages in thread
From: Jose Lamego @ 2016-12-05 14:07 UTC (permalink / raw)
  To: Patrick Ohly; +Cc: yocto


[-- Attachment #1.1: Type: text/plain, Size: 2351 bytes --]



On 12/05/2016 02:30 AM, Patrick Ohly wrote:
> On Fri, 2016-12-02 at 14:29 -0600, Jose Lamego wrote:
>> Patch Series created without a cover letter are named using a
>> non-descriptive generic string.
>>
>> This change names the series using either the first 30 characters in
>> patch #1 plus the remaining patches number, or the patch name for
>> one-patch (1/1) series.
>>
>> [YOCTO #10625]
>>
>> Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
>> ---
>>  patchwork/models.py | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
> 
> When you send different versions of your patches, can you include a
> revision history? Otherwise, it's hard to see what changes between the
> different iterations.
> 
> git notes can be used for that for single-commit changes. See "git
> format-patch --notes" and "git notes".

Got it, thanks for the tip.

> 
>> diff --git a/patchwork/models.py b/patchwork/models.py
>> index 3f531e6..1521641 100644
>> --- a/patchwork/models.py
>> +++ b/patchwork/models.py
>> @@ -1042,6 +1042,19 @@ def _series_supersede_previous_patches(series):
>>  def _on_revision_complete(sender, revision, **kwargs):
>>      series = revision.series
>>
>> +    # Now we know how many patches are in the revision,
>> +    # so we can update the name for series without a cover letter
>> +    if series.name == SERIES_DEFAULT_NAME:
>> +        name = series.latest_revision().ordered_patches()[0].name
>> +        n = re.compile(r'(\[\d+\/\d+\]\s?)')
>> +        name = n.sub('', name)
>> +        c = len(series.latest_revision().ordered_patches())
>> +        # For one-patch series (1/1) without cover letter
>> +        if c == 1:
>> +            series.name = name
>> +        elif c > 1:
>> +            series.name = "\"%s...\" and %s more" % (name[:30], c-1)
>> +
>>      # update series.last_revision
>>      series.last_revision = series.latest_revision()
>>      series.save()
> 
> Looks reasonable to me, but I don't really know the code. Were you
> testing this and noticed cases with c == 0, i.e. cases where the last
> series,name change didn't make sense?
> 
Correct. There are cases where only a cover letter is sent (for example,
consolidated pull requests) so the patches number is 0.


-- 
Jose Lamego | OTC Embedded Platforms & Tools | GDC


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 501 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-05 14:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 23:00 [patchwork][PATCH] patchwork.models: Include first patch's name in series name Jose Lamego
2016-11-30 17:14 ` [patchwork][PATCH v2] patchwork/models: " Jose Lamego
2016-11-30 21:40 ` [patchwork][PATCH v3] patchwork.models: " Jose Lamego
2016-12-02 20:29   ` [patchwork][PATCH v4] " Jose Lamego
2016-12-05  8:30     ` Patrick Ohly
2016-12-05 14:07       ` Jose Lamego

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.