Patchwork [U-Boot,v2] patman: fix gitutil for decorations

login
register
mail settings
Submitter Andreas Bießmann
Date April 16, 2013, 9:52 a.m.
Message ID <1366105938-16485-1-git-send-email-andreas.devel@googlemail.com>
Download mbox | patch
Permalink /patch/236890/
State Accepted
Delegated to: Simon Glass
Headers show

Comments

Andreas Bießmann - April 16, 2013, 9:52 a.m.
The git config parameter log.decorate is quite useful when working with git.
Patman, however can not handle the decorated output when parsing the commit.
To prevent this use the '--no-decorate' switch for git-log.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
---
Changes in v2:
 * add --no-decorate to all git-log instances

 tools/patman/gitutil.py     |    8 +++++---
 tools/patman/patchstream.py |    3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)
Simon Glass - April 16, 2013, 3:48 p.m.
On Tue, Apr 16, 2013 at 2:52 AM, Andreas Bießmann
<andreas.devel@googlemail.com> wrote:
> The git config parameter log.decorate is quite useful when working with git.
> Patman, however can not handle the decorated output when parsing the commit.
> To prevent this use the '--no-decorate' switch for git-log.
>
> Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>

Thanks.

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass - April 16, 2013, 10:12 p.m.
+Tom

On Tue, Apr 16, 2013 at 8:48 AM, Simon Glass <sjg@chromium.org> wrote:
> On Tue, Apr 16, 2013 at 2:52 AM, Andreas Bießmann
> <andreas.devel@googlemail.com> wrote:
>> The git config parameter log.decorate is quite useful when working with git.
>> Patman, however can not handle the decorated output when parsing the commit.
>> To prevent this use the '--no-decorate' switch for git-log.
>>
>> Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
>
> Thanks.
>
> Acked-by: Simon Glass <sjg@chromium.org>

Tom can you please pick this fix up also? It could cause people some problems.

Regards,
Simon
Tom Rini - April 18, 2013, 8:17 p.m.
On Tue, Apr 16, 2013 at 03:12:40PM -0700, Simon Glass wrote:

> +Tom
> 
> On Tue, Apr 16, 2013 at 8:48 AM, Simon Glass <sjg@chromium.org> wrote:
> > On Tue, Apr 16, 2013 at 2:52 AM, Andreas Bie?mann
> > <andreas.devel@googlemail.com> wrote:
> >> The git config parameter log.decorate is quite useful when working with git.
> >> Patman, however can not handle the decorated output when parsing the commit.
> >> To prevent this use the '--no-decorate' switch for git-log.
> >>
> >> Signed-off-by: Andreas Bie?mann <andreas.devel@googlemail.com>
> >
> > Thanks.
> >
> > Acked-by: Simon Glass <sjg@chromium.org>
> 
> Tom can you please pick this fix up also? It could cause people some problems.

Applied to u-boot/master, thanks!

Patch

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index f485750..e31da15 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -39,7 +39,8 @@  def CountCommitsToBranch():
     Return:
         Number of patches that exist on top of the branch
     """
-    pipe = [['git', 'log', '--no-color', '--oneline', '@{upstream}..'],
+    pipe = [['git', 'log', '--no-color', '--oneline', '--no-decorate',
+             '@{upstream}..'],
             ['wc', '-l']]
     stdout = command.RunPipe(pipe, capture=True, oneline=True).stdout
     patch_count = int(stdout)
@@ -92,7 +93,8 @@  def CountCommitsInBranch(git_dir, branch, include_upstream=False):
         Number of patches that exist on top of the branch
     """
     range_expr = GetRangeInBranch(git_dir, branch, include_upstream)
-    pipe = [['git', '--git-dir', git_dir, 'log', '--oneline', range_expr],
+    pipe = [['git', '--git-dir', git_dir, 'log', '--oneline', '--no-decorate',
+             range_expr],
             ['wc', '-l']]
     result = command.RunPipe(pipe, capture=True, oneline=True)
     patch_count = int(result.stdout)
@@ -106,7 +108,7 @@  def CountCommits(commit_range):
     Return:
         Number of patches that exist on top of the branch
     """
-    pipe = [['git', 'log', '--oneline', commit_range],
+    pipe = [['git', 'log', '--oneline', '--no-decorate', commit_range],
             ['wc', '-l']]
     stdout = command.RunPipe(pipe, capture=True, oneline=True).stdout
     patch_count = int(stdout)
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 7334ed3..b4337cc 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -359,7 +359,8 @@  def GetMetaDataForList(commit_range, git_dir=None, count=None,
     Returns:
         A Series object containing information about the commits.
     """
-    params = ['git', 'log', '--no-color', '--reverse', commit_range]
+    params = ['git', 'log', '--no-color', '--reverse', '--no-decorate',
+                    commit_range]
     if count is not None:
         params[2:2] = ['-n%d' % count]
     if git_dir: