Patchwork [U-Boot,v2] patman: force git log commands to not use color

login
register
mail settings
Submitter Albert ARIBAUD
Date Oct. 15, 2012, 7:55 p.m.
Message ID <1350330950-14749-1-git-send-email-albert.u.boot@aribaud.net>
Download mbox | patch
Permalink /patch/191656/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Albert ARIBAUD - Oct. 15, 2012, 7:55 p.m.
Colored logs confuse patman when analyzing logs.
Add --no-color option in git log commands in case
the default config has color.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
Changes in v2:
- fixed line longer than 80 characters

 tools/patman/gitutil.py     |    2 +-
 tools/patman/patchstream.py |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
Simon Glass - Oct. 15, 2012, 8:02 p.m.
On Mon, Oct 15, 2012 at 12:55 PM, Albert ARIBAUD
<albert.u.boot@aribaud.net> wrote:
> Colored logs confuse patman when analyzing logs.
> Add --no-color option in git log commands in case
> the default config has color.
>
> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

Acked-by: Simon Glass <sjg@chromium.org>

Thanks for the fix.

> ---
> Changes in v2:
> - fixed line longer than 80 characters
>
>  tools/patman/gitutil.py     |    2 +-
>  tools/patman/patchstream.py |    3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
> index 59eca99..72d37a0 100644
> --- a/tools/patman/gitutil.py
> +++ b/tools/patman/gitutil.py
> @@ -38,7 +38,7 @@ def CountCommitsToBranch():
>      Return:
>          Number of patches that exist on top of the branch
>      """
> -    pipe = [['git', 'log', '--oneline', '@{upstream}..'],
> +    pipe = [['git', 'log', '--no-color', '--oneline', '@{upstream}..'],
>              ['wc', '-l']]
>      stdout = command.RunPipe(pipe, capture=True, oneline=True)
>      patch_count = int(stdout)
> diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
> index 0503bac..ad280cc 100644
> --- a/tools/patman/patchstream.py
> +++ b/tools/patman/patchstream.py
> @@ -344,7 +344,8 @@ def GetMetaData(start, count):
>          start: Commit to start from: 0=HEAD, 1=next one, etc.
>          count: Number of commits to list
>      """
> -    pipe = [['git', 'log', '--reverse', 'HEAD~%d' % start, '-n%d' % count]]
> +    pipe = [['git', 'log', '--no-color', '--reverse', 'HEAD~%d' % start,
> +       '-n%d' % count]]
>      stdout = command.RunPipe(pipe, capture=True)
>      series = Series()
>      ps = PatchStream(series, is_log=True)
> --
> 1.7.9.5
>
Tom Rini - Oct. 20, 2012, 5:42 p.m.
On Mon, Oct 15, 2012 at 09:55:50AM -0000, Albert ARIBAUD wrote:

> Colored logs confuse patman when analyzing logs.
> Add --no-color option in git log commands in case
> the default config has color.
> 
> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

Patch

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 59eca99..72d37a0 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -38,7 +38,7 @@  def CountCommitsToBranch():
     Return:
         Number of patches that exist on top of the branch
     """
-    pipe = [['git', 'log', '--oneline', '@{upstream}..'],
+    pipe = [['git', 'log', '--no-color', '--oneline', '@{upstream}..'],
             ['wc', '-l']]
     stdout = command.RunPipe(pipe, capture=True, oneline=True)
     patch_count = int(stdout)
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 0503bac..ad280cc 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -344,7 +344,8 @@  def GetMetaData(start, count):
         start: Commit to start from: 0=HEAD, 1=next one, etc.
         count: Number of commits to list
     """
-    pipe = [['git', 'log', '--reverse', 'HEAD~%d' % start, '-n%d' % count]]
+    pipe = [['git', 'log', '--no-color', '--reverse', 'HEAD~%d' % start,
+	'-n%d' % count]]
     stdout = command.RunPipe(pipe, capture=True)
     series = Series()
     ps = PatchStream(series, is_log=True)