Add support for -X to the Bazaar SCM Client.

Review Request #6349 — Created Sept. 20, 2014 and submitted

Information

RBTools
release-0.6.x
cc6e620...

Reviewers

Bazaar now supports excluding files from diffs and posts via
rbtools.utils.diffs.filter_diff, which looks through the
output of bzr diff for lines indicating the start of a file's
diff. If the file specified matches any pattern, that file's
diff is excluded from the resulting diff or post.

Add a test for checking the result of the BazaarClient's diff
with file exclusion.

Unit tests pass.

Ran rbt dff -X .. in a Bazaar repository and got the specified file was
not included.

Description From Last Updated

If there's a diff but no exclude_patterns, I think this would end up calling join() and passing in a single …

daviddavid

This isn't aligned properly. The result... is a parameter to filter(), not len()

daviddavid

This is very minor, but there's an extra blank line here.

anselinaanselina

'fnmatch' imported but unused

reviewbotreviewbot

'fnmatch' imported but unused

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/bazaar.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/bazaar.py
    
    
  2. 
      
brennie
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/bazaar.py
    
    Ignored Files:
        docs/rbtools/rbt/commands/post.rst
        docs/rbtools/rbt/commands/diff.rst
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/bazaar.py
    
    Ignored Files:
        docs/rbtools/rbt/commands/post.rst
        docs/rbtools/rbt/commands/diff.rst
    
    
  2. 
      
david
  1. 
      
  2. rbtools/clients/bazaar.py (Diff revision 2)
     
     
    Show all issues

    If there's a diff but no exclude_patterns, I think this would end up calling join() and passing in a single string (which probably works since strings are iterable but could be very inefficient). How about something like this:

    if exclude_patterns:
        return ''.join(self._filter_diff(diff, exclude_patterns))
    else:
        return diff
    
    1. The execute call has split_lines=True set, so this will return an array of strings.

  3. 
      
anselina
  1. 
      
  2. rbtools/clients/tests.py (Diff revision 2)
     
     
    Show all issues

    This is very minor, but there's an extra blank line here.

  3. 
      
david
  1. 
      
  2. rbtools/clients/tests.py (Diff revision 2)
     
     
     
    Show all issues

    This isn't aligned properly. The result... is a parameter to filter(), not len()

  3. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/svn.py
        rbtools/clients/bazaar.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/tests.py
        rbtools/clients/svn.py
        rbtools/clients/bazaar.py
        rbtools/utils/diffs.py
    
    Ignored Files:
        docs/rbtools/rbt/commands/post.rst
        docs/rbtools/rbt/commands/diff.rst
    
    
  2. rbtools/clients/bazaar.py (Diff revision 3)
     
     
    Show all issues
     'fnmatch' imported but unused
    
  3. rbtools/clients/svn.py (Diff revision 3)
     
     
    Show all issues
     'fnmatch' imported but unused
    
  4. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/svn.py
        rbtools/clients/bazaar.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/tests.py
        rbtools/clients/svn.py
        rbtools/clients/bazaar.py
        rbtools/utils/diffs.py
    
    Ignored Files:
        docs/rbtools/rbt/commands/post.rst
        docs/rbtools/rbt/commands/diff.rst
    
    
  2. 
      
david
  1. Can you separate this into two changes? One for bzr and the other for svn?

    1. The refactoring of _filter_diff into rbtools.utils.diffs.filter_diff is now in review request 6357

  2. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/bazaar.py
    
    Ignored Files:
        docs/rbtools/rbt/commands/post.rst
        docs/rbtools/rbt/commands/diff.rst
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/bazaar.py
    
    Ignored Files:
        docs/rbtools/rbt/commands/post.rst
        docs/rbtools/rbt/commands/diff.rst
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
brennie
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.6.x (f30429b)