Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gogs support #18

Closed
guyzmo opened this issue May 26, 2016 · 12 comments
Closed

Add gogs support #18

guyzmo opened this issue May 26, 2016 · 12 comments

Comments

@guyzmo
Copy link
Owner

guyzmo commented May 26, 2016

No description provided.

@pyhedgehog
Copy link
Contributor

If there are no objections I'm going to implement this one.

@guyzmo
Copy link
Owner Author

guyzmo commented Dec 19, 2016

I got no objections, don't hesitate to ask for my help on anything. I wanted to work on it recently, as I started pushing to a friend's gogs, but I already got my hands full with both the gitlab and bitbucket integrations.
I'm also available on freenode on the channel #git-repo so please come and never hesitate to discuss the project.

pyhedgehog added a commit to pyhedgehog/git-repo that referenced this issue Dec 20, 2016
@pyhedgehog
Copy link
Contributor

pyhedgehog commented Dec 20, 2016

@guyzmo, I have) first version of code: #82
I have a question:
How I'm supposed to implement tests? Current tests (for other services) not working in my environment...

@guyzmo
Copy link
Owner Author

guyzmo commented Dec 20, 2016

for the tests, @pyhedgehog, please come back on IRC so we can discuss quickly what's going wrong.

pyhedgehog added a commit to pyhedgehog/git-repo that referenced this issue Dec 20, 2016
@pyhedgehog
Copy link
Contributor

pyhedgehog commented Dec 21, 2016

Just to log here results of our discussion:

  1. New version of PR should use third-party library (possibly gogs-client).
  2. There are several most wanted features in gogs and gogs-client:
  3. Features for proxy, private and ssl_verify should be implemented in service-independent manner.
  4. Test should be first-class thing. 👍

@guyzmo
Copy link
Owner Author

guyzmo commented Dec 21, 2016

for the feature set, go by babysteps:

  1. implement first the already working features, like you first did (clone, create, delete, open, list) and consider that the user can copy/paste the token in the configuration file
  2. implement the token API as a second step, the best way would be for you to send a PR to gogs-client for them to integrate it, so then git-repo can merge it in!
  3. add the extra stuff we might want to have… You could make a PR to gogs to integrate the fork API, we can 🤞 that PR api lands soon… or you could implement some web scrapping (either in gogs-client or in a third part library extending gogs-client) to support those features.

About the configuration features:

  • ssl_verify is already implemented and I'm merging it in develop, just look for self.insecure on RepositoryService,
  • proxy support is a good thing to have (using the .gitconfig proxy setting), and I believe it's a good case for a new issue and PR, adding it for the four services.
  • private should be a command line argument git gogs foo/bar create --private. And there's already an issue to discuss default configuration implementation, but it's not a priority currently.

About the tests, I did my best to make them easy to write and run, of course I'm around if you need any help.

@guyzmo
Copy link
Owner Author

guyzmo commented Dec 21, 2016

FYI, I actually just checked with a gogs install, I believe it's possible to make a fork, given that the token auth works for this use case:

if you make a POST request with form data containing:

  • uid → id of the new owner, i.e. current user
  • repo_name → new name of the repository
  • description → description of what is that repository

to the URL: /repo/fork/{id of the repository to fork} that should work!

N.B.: I believe there's a visibility parameter, but for my tests, I couldn't check as I was forking a private repository.

@guyzmo
Copy link
Owner Author

guyzmo commented Dec 23, 2016

implementation for tokens in progress over unfoldingWord-dev/python-gitea-client#2 👍

@guyzmo
Copy link
Owner Author

guyzmo commented Dec 23, 2016

BTW, in the module http_utils you'll have to have init create a requests.Session object and replace all requests calls with it. The patch should be fairly straightforward.

Also, we need to make sure that RelativeHttpRequestor (or the requests session within) is a singleton instance across the API lib — which I believe it is.

That's very important to have that in order to be able to write tests in git-repo.

@guyzmo guyzmo modified the milestones: 1.10, Dec 24, 2016
@pyhedgehog
Copy link
Contributor

@guyzmo

if you make a POST request ... to the URL: /repo/fork/{id of the repository to fork} that should work!

How you've avoided Bad Request: no CSRF token present result?

@bkcsoft
Copy link

bkcsoft commented Dec 25, 2016

There are several most wanted features in gogs

@pyhedgehog Please make an issue for each (unless there already is one) so that the devs (myself included) are aware of the need 🙂

@guyzmo
Copy link
Owner Author

guyzmo commented Dec 25, 2016

@bkcsoft well the two most important missing APIs (AFAICT):

and generally for feature completeness:

I'll leave @pyhedgehog make an issue about repository listing, as I'm not sure to the details of the repository listing limitations. Some other API might be nice to have (like the ability to list and push SSH public keys, or have oauth2 authentication).

guyzmo added a commit that referenced this issue Feb 2, 2017
- extraction of all GogsApi code into an adapter subclass
- removal of custom features to use the RepositoryServices equivalents

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- removed url handling code from GogsService
- added handling of new URL details parameters in RepositoryService

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- added env variable GOGS_URL to select the target (defaults to
  try.gogs.io)
- added PLACEHOLDER in config for any target URL

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- extraction of all GogsApi code into an adapter subclass
- removal of custom features to use the RepositoryServices equivalents

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- removed url handling code from GogsService
- added handling of new URL details parameters in RepositoryService

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- added env variable GOGS_URL to select the target (defaults to
  try.gogs.io)
- added PLACEHOLDER in config for any target URL

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- extraction of all GogsApi code into an adapter subclass
- removal of custom features to use the RepositoryServices equivalents

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- removed url handling code from GogsService
- added handling of new URL details parameters in RepositoryService

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- added env variable GOGS_URL to select the target (defaults to
  try.gogs.io)
- added PLACEHOLDER in config for any target URL

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- removed url handling code from GogsService
- added handling of new URL details parameters in RepositoryService

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
guyzmo added a commit that referenced this issue Feb 2, 2017
- added env variable GOGS_URL to select the target (defaults to
  try.gogs.io)
- added PLACEHOLDER in config for any target URL

Fixes: #18
Signed-off-by: Guyzmo <[email protected]>
@guyzmo guyzmo added ready and removed in progress labels Feb 2, 2017
@guyzmo guyzmo closed this as completed in 5c37245 Feb 2, 2017
@guyzmo guyzmo removed the ready label Feb 2, 2017
guyzmo added a commit that referenced this issue Feb 6, 2017
🚧 Features

* Gogs (fixes #18) (kudos @pyhedgehog)
* certificate pinning (fixes #88)
* non-standard http ports (fixes #81)
* possibility to use custom SSH address (fixes #107)
* .gitconfig in XDG home directory (fixes #95)
* .gitconfig's proxy definition support (fixes #105)
* automatically grab PR title/body from last commit (fixes #73)

🚒 Bugfixes

* refactoring of listings, improved list command (fixes #114)

💄 Cosmetics

* Switch to a git tag scheme for versioning (using setuptools-scm)
* Updated README with new informations
* Added @pyhedgehog to contributors
* Updated TODO list

Signed-off-by: Guyzmo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants