Fix output of rbt diff/post for git when -X specified.
Review Request #6350 — Created Sept. 21, 2014 and submitted
Currently, git's filter support does the opposite behaviour
(only includes files that match all exclude_patterns).A new module,
rbtools.utils.diffs
, specifies helper functions
filename_match_any_patterns
, which determines if a filename matches
at least one of the given patterns, and
remove_filenames_matching_patterns
, which returns an iterable of the
filenames that do not match any given pattern.The parameters to
git diff
andgit diff-tree
have been
reordered so that the revision specification is always the last
argument before the filenames.
All unit tests pass now.
Generated diffs withrbt diff
in a git repository with more than
one file changed. When-X filename
was specified, only that
file's diff was excluded from the output.
Description | From | Last Updated |
---|---|---|
'functools' imported but unused |
reviewbot | |
'itertools' imported but unused |
reviewbot | |
'fnmatch' imported but unused |
reviewbot | |
Col: 1 E302 expected 2 blank lines, found 1 |
reviewbot | |
Imports should be in alphabetical order |
AS asalahli | |
Blank line between these. |
chipx86 | |
Not sure if this matters, but concatenating two lists is more computationally expensive than list creation. Feel free to drop … |
AS asalahli | |
Would you mind documenting the output we expect to get briefly, so that it's obvious why we're doing filename.split()[-1]? |
chipx86 | |
I feel that the function names are a bit generic, given that we're specifically working with filenames. How about filename_matches_any_pattern? |
chipx86 | |
Same idea here. |
chipx86 | |
Small nit, but when dealing with multi-line generators or list comprehensions, we usually do: ( filename for ... ... ) |
chipx86 | |
Nit - for every new .py file, we like to include: from future import unicode_literals at the top of the … |
mike_conley | |
The closing parenthesis should probably not be in a seperate line |
AS asalahli |
- Change Summary:
-
Add students group.
- Commit:
-
766e24e72bdf02d944ae0acc97cb95b4b271778dc73434dc32afbfe5c370beaf9028700bd55c58b6
- Groups:
-
- Diff:
Revision 2 (+31 -19)
-
Tool: Pyflakes Processed Files: rbtools/utils/diffs.py rbtools/clients/git.py Tool: PEP8 Style Checker Processed Files: rbtools/utils/diffs.py rbtools/clients/git.py
-
-
-
Would you mind documenting the output we expect to get briefly, so that it's obvious why we're doing
filename.split()[-1]
? -
I feel that the function names are a bit generic, given that we're specifically working with filenames. How about
filename_matches_any_pattern
? -
-
Small nit, but when dealing with multi-line generators or list comprehensions, we usually do:
( filename for ... ... )
- Change Summary:
-
Explain the output of git diff-tree
Style changes.
Better names for functions.
- Commit:
-
c73434dc32afbfe5c370beaf9028700bd55c58b63492099029e898224cc96bcf0163faa73760b7f1
- Diff:
-
Revision 3 (+35 -18)
-
Tool: PEP8 Style Checker Processed Files: rbtools/utils/diffs.py rbtools/clients/git.py Tool: Pyflakes Processed Files: rbtools/utils/diffs.py rbtools/clients/git.py
- Change Summary:
-
Update names of functions in rr description.
- Description:
-
Currently, git's filter support does the opposite behaviour
(only includes files that match all exclude_patterns). A new module,
rbtools.utils.diffs
, specifies helper functions~ match_any_patterns
, which determines if a filename matches at~ least one of the given patterns, and remove_pattern_matches
,~ which returns an iterable of the filenames that do not match any ~ given pattern. ~ filename_match_any_patterns
, which determines if a filename matches~ at least one of the given patterns, and ~ remove_filenames_matching_patterns
, which returns an iterable of the~ filenames that do not match any given pattern. The parameters to
git diff
andgit diff-tree
have beenreordered so that the revision specification is always the last argument before the filenames.