-
-
Not a show-stopper by any means, but I find it odd that we'd have two classes here that are essentially equivalent. Same with the public and private organization forms. If there's a good reason for this, feel free to drop. Else, we might just want to consolidate to a generic GitHubForm and GitHubOrgForm.
-
Should this be a one-liner instead? I don't foresee Github supporting other SCM tools anytime in the near future.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add support for hosting services.
Review Request #3073 — Created April 23, 2012 and submitted
Add support for hosting services. This introduces top-level support for hosting services. Previously, Review Board had a basic concept of hosting services when configuring a repository. They were nothing more than some pattern matches that provided helpful fields for configuring a repository's information. Now, we have a top-level concept of a hosting service. Subclasses of HostingService are used to provide specific configuration forms for repositories, provide an ability to request an authorization token from the hosting service, and provide basic file access. The various fields (such as a GitHub repository name or whether it's a public personal account or a private organization) are now stored along with the Repository in its new extra_data field. This is used later for both repository access and configuration. When setting up a repository for a hosting service, the user is expected to link an account or use an existing linked account for that service. When linking an account on hosting services that require authorization, Review Board will perform the authorization request and, if successful, store any service-specific tokens or data in the HostingServiceAccount model. All the existing hosting services have been moved into HostingService subclasses. Existing configurations will no longer show a hosting service tied to the account. Instead, they will just appear as custom repositories. Users are always free to reconfigure their accounts. GitHub is the first hosting service we support in an extended way. We get an authorization token, store it, and use it for file requests with their v3 API. TODO for future changes: * Fix bug trackers. Right now, the code is temporarily disabled. I will be moving to custom forms for configuring this, just like we have with repository configuration now. * Auto-generate an SSH key when needed, and upload to the account. What I have currently is unlikely to change much (aside from comments in reviews), so look through it and see if things look sane.
Lots of manual testing with GitHub accounts and with different configurations of options. Triggered most of the validations that could naturally be triggered in the web UI.
Description | From | Last Updated |
---|---|---|
Is there a reason to make the new methods 'get_file_exists' instead of just 'file_exists'? I think we'd benefit having consistent … |
SM smacleod | |
This CharField is missing a max_length. It seems like you have max_length set for some of the fields, but not … |
SM smacleod | |
> 80 characters (81). Couldn't you drop all of the strings down a line and just 4 space indent? You're … |
SM smacleod | |
Too many blanks, remove a line. |
SM smacleod | |
no max_length. |
SM smacleod | |
Not a show-stopper by any means, but I find it odd that we'd have two classes here that are essentially … |
mike_conley | |
no max_length. |
SM smacleod | |
no max_length. |
SM smacleod | |
no max_length. |
SM smacleod | |
no max_length. |
SM smacleod | |
no max_length. |
SM smacleod | |
no max_length. |
SM smacleod | |
Should this be a one-liner instead? I don't foresee Github supporting other SCM tools anytime in the near future. |
mike_conley | |
Should we be using methods beginning with '_'? Aren't we saying the method is "private" when we begin with '_', … |
SM smacleod | |
This looks a little funky to me. Would it be better to break the first line of the call, and … |
SM smacleod | |
This mime-type can be predictably generated given the version information, should we be hard-coding it? |
SM smacleod | |
The string for the mime-type is repeated here. Should we be consolidating where this string is kept for maintainability? Also, … |
SM smacleod | |
no max_length. |
SM smacleod | |
no max_length. |
SM smacleod | |
> 80 characters (81). |
SM smacleod | |
no max_length. |
SM smacleod | |
Why the extra ws on lines 14 and 16? |
mike_conley | |
typo: accessible |
mike_conley | |
typo: account |
mike_conley | |
Should this be get_*? see other comment. |
SM smacleod | |
Should all of these methods begin with '_'? See my comment above in the GitHub hosting service. |
SM smacleod | |
Why not just define these as default values in the function header? |
mike_conley | |
no max_length. |
SM smacleod | |
typo: any |
mike_conley | |
Should probably be l10n'able. |
mike_conley | |
Should probably be l10n'able. |
mike_conley | |
Should probably be l10n'able. |
mike_conley | |
Should probably be l10n'able. |
mike_conley | |
Should probably be l10n'able. |
mike_conley | |
Why do you need the 'not self.errors' here? isn't it redundant from the parent if case? Or, do the 'validate_*()' … |
SM smacleod | |
"thunk" ? |
SM smacleod | |
Should this be 'get_*' - see my other comment. |
SM smacleod | |
I first read this as 'hostings vcs'. In a product dealing with many "version control systems", my mind draws me … |
SM smacleod | |
Where is this i defined? I can't seem to find it. We might want var i instead. |
mike_conley | |
Or should these be indented so that the periods line up with the period before "append"? |
mike_conley | |
Same as earlier - where was this i defined? |
mike_conley | |
It seems like "for field in" would be nicer style. |
david | |
Isn't this bad? |
david | |
Alignment doesn't look quite right. |
david |
-
Wow, quite the change. Overall it's looking really good, I couldn't find any major issues. I had problems getting the patch working. ./reviewboard/manage.py evolve is crashing on me, but It looks like something completely unrelated to this change. I'll investigate more and try and test the change once I get everything working. I skipped over the javascript in this review, since I'm far from familiar with it. I might come back and take a good look through it when I get the change working. Note: The hostingsvcs/__init__.py is missing from the patch.
-
Is there a reason to make the new methods 'get_file_exists' instead of just 'file_exists'? I think we'd benefit having consistent methods when dealing with the repository or the scm tool directly. (Looking at the new hosting_services model, it appears to use the 'get_*' signature as well, but the tools are still using 'file_exists')
-
This CharField is missing a max_length. It seems like you have max_length set for some of the fields, but not others. I couldn't discern a scheme for whether or not the field was given a max_length. This applies to many of the services, not just codebasehq. If I'm not catching something here about why the max_lengths are missing, please drop all the issues (and sorry for the spam).
-
> 80 characters (81). Couldn't you drop all of the strings down a line and just 4 space indent? You're probably ignoring this on purpose for style and consistency, so feel free to drop this issue.
-
-
-
-
-
-
-
-
-
Should we be using methods beginning with '_'? Aren't we saying the method is "private" when we begin with '_', and not promising it will be stable? By having this hosting service rely on these methods you're setting a precedent for future hosting services.
-
This looks a little funky to me. Would it be better to break the first line of the call, and just 4-space indent all of the arguments?
-
This mime-type can be predictably generated given the version information, should we be hard-coding it?
-
The string for the mime-type is repeated here. Should we be consolidating where this string is kept for maintainability? Also, see above about generating it.
-
-
-
-
-
-
-
-
-
Why do you need the 'not self.errors' here? isn't it redundant from the parent if case? Or, do the 'validate_*()' calls set self.errors? If this is the case, a comment might be nice here to explain the redundancy.
-
-
-
I first read this as 'hostings vcs'. In a product dealing with many "version control systems", my mind draws me to that instead of the desired 'hosting services'.
- Change Summary:
-
* Made the changes requested, except where there's ongoing discussion or I've explained otherwise. * Moved the code to sit on top of RB 1.6.x, since that's where we'll be doing the first release. * Fixed a problem when saving Custom repositories in the unit tests.
- Change Summary:
-
* Fixed many blockers this had on RB 1.6. I had previously developed and tested on RB 1.7, and then backported before review. This includes: * Added a modified version of Django's admin change_form.html with a {% block %}, allowing us to override the fieldsets for the admin page. This makes it easier to update things on our end (needed for 1.6). Django 1.4 already includes this block. * Removed a staticfiles import in a template. Important additions: * Added unit tests for field validation, API URLs, the repository form, and more. * Added support for hosting services that don't require authorization yet (basically, everything but GitHub). Accounts are still created and stored, but they don't go through the service's authorization, and the user isn't asked for a password. * Made it possible to determine if a hosting service account is currently authorized (basically, checking if the data locally stored about the account is what we expect -- we can invalidate API versions this way). * Moved some code from RepositoryForm to HostingService, in order to simplify some things. * Added hosting service info to the admin list page for repositories. Fixes: * Fixed issues that came up in those unit tests (such as incorrect field names used, and some problems with assumptions about hosting services having plans, and other general form mishaps). * Fixed defaults in RepositoryForm when opening an existing repository. At this point, I badly want to get this change in, and my testing shows it's working pretty well. The bug tracker stuff is the big P0 for the next 1.6 release, but that will be a separate change. For now, it's just stubbed out. The interdiff will be helpful for these changes.
- Description:
-
Add support for hosting services.
This introduces top-level support for hosting services. Previously,
Review Board had a basic concept of hosting services when configuring a repository. They were nothing more than some pattern matches that provided helpful fields for configuring a repository's information. Now, we have a top-level concept of a hosting service. Subclasses of
HostingService are used to provide specific configuration forms for repositories, provide an ability to request an authorization token from the hosting service, and provide basic file access. The various fields (such as a GitHub repository name or whether it's a
public personal account or a private organization) are now stored along with the Repository in its new extra_data field. This is used later for both repository access and configuration. When setting up a repository for a hosting service, the user is expected
to link an account or use an existing linked account for that service. When linking an account on hosting services that require authorization, Review Board will perform the authorization request and, if successful, store any service-specific tokens or data in the HostingServiceAccount model. All the existing hosting services have been moved into HostingService
subclasses. Existing configurations will no longer show a hosting service tied to the account. Instead, they will just appear as custom repositories. Users are always free to reconfigure their accounts. GitHub is the first hosting service we support in an extended way. We
get an authorization token, store it, and use it for file requests with their v3 API. ~ TODO:
~ TODO for future changes:
-
Fix bug trackers. Right now, the code is temporarily disabled. I will
be moving to custom forms for configuring this, just like we have with
repository configuration now.
-
Auto-generate an SSH key when needed, and upload to the account.
- -
Unit tests.
What I have currently is unlikely to change much (aside from comments in
reviews), so look through it and see if things look sane. -