Capabilities with better moved files support
Review Request #2918 — Created Feb. 26, 2012 and submitted
Information | |
---|---|
ddruska | |
RBTools | |
master | |
Reviewers | |
reviewboard | |
Added post-review client capability checking and git moved-files support.
Tested the following cases: 1. Posted a review with up-to-date RB and rbtools. Moved files were tracked. 2. Posted a review where the RB server has moved_files=False. Moved files were not tracked. 3. Posted a review where the RB server has no "compatabilities". Moved files were not tracked. 4. Posted a review where the RB server has no "moved_files" capability (and again with no "diffs" category). Moved files were not tracked. Unit tests pass, don't really know how to write tests for this since it requires a server (mock objects?).
Description | From | Last Updated |
---|---|---|
Summary should be on the same line. Since this all fits on one line, just put the text right up … |
|
|
Should specifically catch a KeyError. |
|
|
Too much repeat code. I'd suggest something like: cmdline = [self.git, "diff", .....] if has_capability(...): cmdline.append('-M') return execute(cmdline) |
|
|
I'd prefer we set the server instead. There may be other useful objects later. Given that, we'd probably want to … |
|
|
Should just call this capabilities, or caps, or something. |
|
|
I'd imagine this could fit on one line. if not, perhaps rename capability_list to capabilities or caps. |
|
|
This could just be return execute(cmdline). i.e: if (self.server and self.server.capabilities.has_capability('diffs', 'moved_files')): cmdline.append('-M') return execute(cmdline) |
ME medanat | |
We always pass a value to this, right? Probably no need for a default. |
|
|
Blank line above this. |
|
|
See below on this, but I don't think capabilities should be a default parameter. I think it should always take … |
|
Change Summary:
Added capabilities changes.
Summary: |
|
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||
Testing Done: |
|
||||||||||||||||||
Branch: |
|
||||||||||||||||||
Diff: |
Revision 2 (+34 -2) |
-
-
rbtools/api/capabilities.py (Diff revision 2) Summary should be on the same line. Since this all fits on one line, just put the text right up against the """. Probably makes more sense to say "Retrieves and stores"
-
-
rbtools/clients/git.py (Diff revision 2) Too much repeat code. I'd suggest something like: cmdline = [self.git, "diff", .....] if has_capability(...): cmdline.append('-M') return execute(cmdline)
-
rbtools/postreview.py (Diff revision 2) I'd prefer we set the server instead. There may be other useful objects later. Given that, we'd probably want to rename get_capabilities() to load_capabilities(), and put that call after check_api_version(). Then things can just access server.capabilities.
Change Summary:
Now capabilities are held on the server, and scmtools are passed a server pointer.
Description: |
|
||||||
---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+34 -5) |
-
-
-
rbtools/postreview.py (Diff revision 3) I'd imagine this could fit on one line. if not, perhaps rename capability_list to capabilities or caps.
Change Summary:
Renamed 'capabilities_list' to 'caps'. Git client is resilient to server being None.
Testing Done: |
|
|||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+46 -5) |
-
-
rbtools/clients/git.py (Diff revision 4) This could just be return execute(cmdline). i.e: if (self.server and self.server.capabilities.has_capability('diffs', 'moved_files')): cmdline.append('-M') return execute(cmdline)
-
-
rbtools/api/capabilities.py (Diff revision 5) We always pass a value to this, right? Probably no need for a default.
-
-
rbtools/postreview.py (Diff revision 5) See below on this, but I don't think capabilities should be a default parameter. I think it should always take a value. In that case, just pass caps as a standard argument, not keyword argument. Makes this line read better too :)
Change Summary:
Fixed formatting issues. Pass capabilities as a default parameter instead of a kwarg.
Diff: |
Revision 6 (+47 -5) |
---|