Improve robustness of --svn-show-copies-as-adds option and respect included files
Review Request #6960 — Created Feb. 18, 2015 and submitted
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 tosvn 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:
- 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.
- 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.- In
history_scheduled_with_commit()
add '-q' argument tosvn 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.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.- 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 ',' |
reviewbot | |
Col: 43 E231 missing whitespace after ',' |
reviewbot | |
Col: 14 E713 test for membership should be 'not in' |
reviewbot | |
local variable 'result' is assigned to but never used |
reviewbot | |
This should indeed go into a common place. Maybe rbtools/utils/checks.py? |
david | |
Please remove the blank line between these two (nose and six are both third-party packages). |
david | |
I don't think we have anywhere else with newlines in the help text. How about: help='Treat copied or moved files … |
david | |
Col: 1 E302 expected 2 blank lines, found 1 |
reviewbot | |
Variable names should use underscores, not camelCase. |
david |
-
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
- Description:
-
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 tosvn 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:
- 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.
- 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.
- In
history_scheduled_with_commit()
add '-q' argument tosvn 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.
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.
- 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.- - One question: I borrowed
is_valid_version()
from clients/git.py. Is it preferable to move this function to a common location to avoid duplicated code? If so, what location do you recommend? - Commit:
-
001f8c0adea70e81541c829ca39a8aef7e2b3251d10cab0ca363e5041e7a1ac54b307a3f54a6a864
-
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
-
-
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
- Change Summary:
-
In
check_update()
need to grabsvn_show_copies_as_adds
option viagetattr()
to properly handle commands, such as 'rbt status', which do not recognize --svn-show-copies as adds as a command line option. - Commit:
-
9d8e836937d1c09ec510a2b1949b1d29221c4a9452dc85c91eaa511311e1807fded30b07d35b6157
-
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
-
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