Improve robustness of --svn-show-copies-as-adds option and respect included files

Review Request #6960 — Created Feb. 18, 2015 and submitted

Information

RBTools
master
bd7b63e...

Reviewers

This fixes Issue #3649 where previously history_scheduled_with_commit() did not respect explicitly included files when determining if an SVN changeset contained an addition-with-history. history_scheduled_with_commit() now adds included files to the call to svn status similar to how it is done for an SVN changelist.

In the process of fixing the issue I came across several other minor deficiencies related to the --svn-show-copies-as-adds option and I have also cleaned those up:

  1. The SVN client version is checked before doing anything related to --svn-show-copies-as-adds, as the underlying SVN argument (--show-copies-as-adds) did not come into existence until version 1.7.0.
  2. The existence of --svn-show-copies-as-adds is checked before calling history_scheduled_with_commit(). If the user has already specified this option then there is no point in doing additional work.
  3. In history_scheduled_with_commit() add '-q' argument to svn status call to suppress unversioned items. For working copies with unversioned items, the addition of this argument will result in fewer status lines to process.
  4. svn status reports details about files contained in changelists at the end of its output, after detailing all non-changelist files. In the case where we are not working with a changelist, return early when we get to the changelist "section" of the status output so as not to possibly incorrectly detect history from a changelist.
  5. In history_scheduled_with_commit() respect exclude_patterns so as not to possibly incorrectly detect history from an excluded file.

To support checking the SVN client version, is_valid_version() is relocated from rbtools/clients/git.py to rbtools/utils/checks.py. Moving to this common location allows the function to be used by both the git and SVN clients without duplicating code. The unit test related to this function (test_is_valid_version()) is also relocated to rbtools/utils/tests.py.

I've added unit tests which should exercise all aspects of these changes.
Description From Last Updated

Col: 41 E231 missing whitespace after ','

reviewbotreviewbot

Col: 43 E231 missing whitespace after ','

reviewbotreviewbot

Col: 14 E713 test for membership should be 'not in'

reviewbotreviewbot

local variable 'result' is assigned to but never used

reviewbotreviewbot

This should indeed go into a common place. Maybe rbtools/utils/checks.py?

daviddavid

Please remove the blank line between these two (nose and six are both third-party packages).

daviddavid

I don't think we have anywhere else with newlines in the help text. How about: help='Treat copied or moved files …

daviddavid

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Variable names should use underscores, not camelCase.

daviddavid
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/svn.py
        rbtools/commands/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/svn.py
        rbtools/commands/__init__.py
    
    
  2. rbtools/clients/svn.py (Diff revision 1)
     
     
    Col: 41
     E231 missing whitespace after ','
    
  3. rbtools/clients/svn.py (Diff revision 1)
     
     
    Col: 43
     E231 missing whitespace after ','
    
  4. rbtools/clients/svn.py (Diff revision 1)
     
     
    Col: 14
     E713 test for membership should be 'not in'
    
  5. rbtools/clients/tests.py (Diff revision 1)
     
     
     local variable 'result' is assigned to but never used
    
  6. 
      
gmyers
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/svn.py
        rbtools/commands/__init__.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/clients/tests.py
        rbtools/clients/svn.py
        rbtools/commands/__init__.py
    
    
  2. 
      
david
  1. 
      
  2. rbtools/clients/svn.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     

    This should indeed go into a common place. Maybe rbtools/utils/checks.py?

  3. rbtools/clients/tests.py (Diff revision 2)
     
     
     
     

    Please remove the blank line between these two (nose and six are both third-party packages).

  4. rbtools/commands/__init__.py (Diff revision 2)
     
     
     
     

    I don't think we have anywhere else with newlines in the help text. How about:

    help='Treat copied or moved files as new files '
         '(Subversion 1.7+ only).',
    
    1. I do see a few other instances where there are newlines in the help text.  In particular I modeled this after the text for --include and --exclude where a newline appears between the basic help description and a list of supported SCM clients.  That said, I'm happy to switch to your suggested text if that would be preferred.
    2. I think I would prefer that (I'll go through and clean up the existing ones).

    3. Actually, nevermind, it's more prevalent than I had thought. As-is is fine.

  5. 
      
gmyers
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/utils/tests.py
        rbtools/clients/tests.py
        rbtools/commands/__init__.py
        rbtools/clients/git.py
        rbtools/utils/checks.py
        rbtools/clients/svn.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/utils/tests.py
        rbtools/clients/tests.py
        rbtools/commands/__init__.py
        rbtools/clients/git.py
        rbtools/utils/checks.py
        rbtools/clients/svn.py
    
    
  2. rbtools/utils/checks.py (Diff revision 3)
     
     
    Col: 1
     E302 expected 2 blank lines, found 1
    
  3. 
      
gmyers
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/utils/tests.py
        rbtools/clients/tests.py
        rbtools/commands/__init__.py
        rbtools/clients/git.py
        rbtools/utils/checks.py
        rbtools/clients/svn.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/utils/tests.py
        rbtools/clients/tests.py
        rbtools/commands/__init__.py
        rbtools/clients/git.py
        rbtools/utils/checks.py
        rbtools/clients/svn.py
    
    
  2. 
      
gmyers
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/utils/tests.py
        rbtools/clients/tests.py
        rbtools/commands/__init__.py
        rbtools/clients/git.py
        rbtools/utils/checks.py
        rbtools/clients/svn.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/utils/tests.py
        rbtools/clients/tests.py
        rbtools/commands/__init__.py
        rbtools/clients/git.py
        rbtools/utils/checks.py
        rbtools/clients/svn.py
    
    
  2. 
      
david
  1. 
      
  2. rbtools/clients/svn.py (Diff revision 5)
     
     
     

    Variable names should use underscores, not camelCase.

  3. 
      
gmyers
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        rbtools/utils/tests.py
        rbtools/clients/tests.py
        rbtools/commands/__init__.py
        rbtools/clients/git.py
        rbtools/utils/checks.py
        rbtools/clients/svn.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        rbtools/utils/tests.py
        rbtools/clients/tests.py
        rbtools/commands/__init__.py
        rbtools/clients/git.py
        rbtools/utils/checks.py
        rbtools/clients/svn.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
gmyers
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.7.x (e20a1ba)
Loading...