Add relative exclude pattern support to Git, SVN, CVS, and Bazaar SCMClients.
Review Request #6383 — Created Sept. 29, 2014 and submitted
Exclude patterns are now interpreted as relative to the current
working directory.Add
rbtools.utils.diffs:normalize_patternswhich normalizes patterns,
which are interpreted as relative to the current working directory,
into patterns matching only absolute paths.Simplify logic of
rbtools.utils.diffs:filter_diffto use
filename_match_any_patternsinstead of looping through patterns.The
rbtools.utils.diffsfunctionsfilename_match_any_patterns,
filter_diff, andremove_filenames_matching_patternsnow take an
extra parameter:base_dir. This argument indicates the directory
that the files are located in. If this argument is not provided, it is
interpreted as the current working directory.Add
GitClient._get_root_directorywhich finds the absolute path of
the git repository.All SCMClients that support file exclusion normalize their exclude
patterns. This is not done outside of the respectivediffmethods
because Perforce exclude patterns require special treatment for depot
file patterns.The SVN SCMClient no longer prepends
/to patterns as it no longer
matches the/in theIndex:line as the file path as they are now
interpreted as relative file paths.Update documentation for
rbt diffandrbt postto indicate that
-Xspecifies relative exclude patterns. Also add a note that Perforce
can specify depot-specific exclude patterns.
Unit tests pass.
Ran
rbt diff -Xin SVN, CVS, Git, and Bazaar repositories with
relative paths. Files were excluded as expected.
| Description | From | Last Updated |
|---|---|---|
|
Col: 1 E302 expected 2 blank lines, found 1 |
|
-
Tool: Pyflakes Processed Files: rbtools/clients/cvs.py rbtools/clients/svn.py rbtools/clients/bazaar.py rbtools/clients/git.py rbtools/utils/diffs.py Ignored Files: docs/rbtools/rbt/commands/post.rst docs/rbtools/rbt/commands/diff.rst Tool: PEP8 Style Checker Processed Files: rbtools/clients/cvs.py rbtools/clients/svn.py rbtools/clients/bazaar.py rbtools/clients/git.py rbtools/utils/diffs.py Ignored Files: docs/rbtools/rbt/commands/post.rst docs/rbtools/rbt/commands/diff.rst
Tool: Pyflakes Processed Files: rbtools/clients/cvs.py rbtools/clients/svn.py rbtools/clients/bazaar.py rbtools/clients/git.py rbtools/utils/diffs.py Ignored Files: docs/rbtools/rbt/commands/post.rst docs/rbtools/rbt/commands/diff.rst Tool: PEP8 Style Checker Processed Files: rbtools/clients/cvs.py rbtools/clients/svn.py rbtools/clients/bazaar.py rbtools/clients/git.py rbtools/utils/diffs.py Ignored Files: docs/rbtools/rbt/commands/post.rst docs/rbtools/rbt/commands/diff.rst