On 06 Jan 17:12, Finucane, Stephen wrote: > On 28 Nov 10:14, Mauro Carvalho Chehab wrote: > > From: Laurent Pinchart <[email protected]> > > > > The function returns the list of files touched by a patch, after > > stripping the leading component of the path name. > > > > Signed-off-by: Laurent Pinchart <[email protected]> > > Signed-off-by: Mauro Carvalho Chehab <[email protected]> > > --- > > patchwork/parser.py | 34 ++++++++++++++++++++++++++++++++++ > > 1 file changed, 34 insertions(+) > > > > diff --git a/patchwork/parser.py b/patchwork/parser.py > > index 13b4466a4b14..2dbbf2b7b667 100644 > > --- a/patchwork/parser.py > > +++ b/patchwork/parser.py > > @@ -238,6 +238,34 @@ def extract_tags(content, tags): > > > > return counts > > > > +def patch_get_filenames(str): > > + # normalise spaces > > + str = str.replace('\r', '') > > + str = str.strip() + '\n' > > + > > + filenames = {} > > + > > + for line in str.split('\n'): > > + > > + if len(line) <= 0: > > + continue > > + > > + filename_match = _filename_re.match(line) > > + if not filename_match: > > + continue > > + > > + filename = filename_match.group(2) > > + if filename.startswith('/dev/null'): > > + continue > > + > > + filename = '/'.join(filename.split('/')[1:]) > > + filenames[filename] = True > > + > > + filenames = filenames.keys() > > + filenames.sort() > > + > > + return filenames > > This function needs unit tests. Other than that I'm happy with this. > > Stephen
Actually, none of this file is explicitly unit tested. That should probably be fixed but for now the tests added later cover this code. Merged. _______________________________________________ Patchwork mailing list [email protected] https://lists.ozlabs.org/listinfo/patchwork
