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_patterns
which 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_diff
to use
filename_match_any_patterns
instead of looping through patterns.The
rbtools.utils.diffs
functionsfilename_match_any_patterns
,
filter_diff
, andremove_filenames_matching_patterns
now 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_directory
which 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 respectivediff
methods
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 diff
andrbt post
to indicate that
-X
specifies relative exclude patterns. Also add a note that Perforce
can specify depot-specific exclude patterns.
Unit tests pass.
Ran
rbt diff -X
in 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 |
reviewbot |
-
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