Browse Source

patman: fix gitutil for decorations

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>
Acked-by: Simon Glass <sjg@chromium.org>
Andreas Bießmann 12 years ago
parent
commit
2386060c16
2 changed files with 7 additions and 4 deletions
  1. 5 3
      tools/patman/gitutil.py
  2. 2 1
      tools/patman/patchstream.py

+ 5 - 3
tools/patman/gitutil.py

@@ -39,7 +39,8 @@ def CountCommitsToBranch():
     Return:
     Return:
         Number of patches that exist on top of the branch
         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']]
             ['wc', '-l']]
     stdout = command.RunPipe(pipe, capture=True, oneline=True).stdout
     stdout = command.RunPipe(pipe, capture=True, oneline=True).stdout
     patch_count = int(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
         Number of patches that exist on top of the branch
     """
     """
     range_expr = GetRangeInBranch(git_dir, branch, include_upstream)
     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']]
             ['wc', '-l']]
     result = command.RunPipe(pipe, capture=True, oneline=True)
     result = command.RunPipe(pipe, capture=True, oneline=True)
     patch_count = int(result.stdout)
     patch_count = int(result.stdout)
@@ -106,7 +108,7 @@ def CountCommits(commit_range):
     Return:
     Return:
         Number of patches that exist on top of the branch
         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']]
             ['wc', '-l']]
     stdout = command.RunPipe(pipe, capture=True, oneline=True).stdout
     stdout = command.RunPipe(pipe, capture=True, oneline=True).stdout
     patch_count = int(stdout)
     patch_count = int(stdout)

+ 2 - 1
tools/patman/patchstream.py

@@ -359,7 +359,8 @@ def GetMetaDataForList(commit_range, git_dir=None, count=None,
     Returns:
     Returns:
         A Series object containing information about the commits.
         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:
     if count is not None:
         params[2:2] = ['-n%d' % count]
         params[2:2] = ['-n%d' % count]
     if git_dir:
     if git_dir: