mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
patman: Add a test for PatchStream tags
The current functional tests run most of patman. Add a smaller test that just checks tag handling with the PatchStream class. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
"""Handles parsing a stream of commits/emails from 'git log' or other source"""
|
||||
|
||||
import datetime
|
||||
import io
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
@@ -81,6 +82,28 @@ class PatchStream:
|
||||
self.state = STATE_MSG_HEADER # What state are we in?
|
||||
self.commit = None # Current commit
|
||||
|
||||
@staticmethod
|
||||
def process_text(text, is_comment=False):
|
||||
"""Process some text through this class using a default Commit/Series
|
||||
|
||||
Args:
|
||||
text (str): Text to parse
|
||||
is_comment (bool): True if this is a comment rather than a patch.
|
||||
If True, PatchStream doesn't expect a patch subject at the
|
||||
start, but jumps straight into the body
|
||||
|
||||
Returns:
|
||||
PatchStream: object with results
|
||||
"""
|
||||
pstrm = PatchStream(Series())
|
||||
pstrm.commit = commit.Commit(None)
|
||||
infd = io.StringIO(text)
|
||||
outfd = io.StringIO()
|
||||
if is_comment:
|
||||
pstrm.state = STATE_PATCH_HEADER
|
||||
pstrm.process_stream(infd, outfd)
|
||||
return pstrm
|
||||
|
||||
def _add_warn(self, warn):
|
||||
"""Add a new warning to report to the user about the current commit
|
||||
|
||||
|
Reference in New Issue
Block a user