Commit Graph

11 Commits

Author SHA1 Message Date
6543 13bc82009c
API endpoint for repo transfer (#9947)
* squash

* optimize

* fail before make any changes

* fix-header
2020-01-31 15:49:04 +00:00
Lunny Xiao f2d12f7b03
Fix pull view when head repository or head branch missed and close related pull requests when delete head repository or head branch (#9927)
* fix pull view when head repository or head branch missed and close related pull requests when delete branch

* fix pull view broken when head repository deleted

* close pull requests when head repositories deleted

* Add tests for broken pull request head repository or branch

* fix typo

* ignore special error when close pull request

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-01-25 10:48:22 +08:00
Lunny Xiao d32eac44b1 Move RepoWorkingPool to services/repository package (#9754)
* Move RepoWorkingPool to services/repository package

* Make repoWorkingPool private

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-01-15 04:14:50 +01:00
Lunny Xiao b465d0d787
Move create/fork repository from models to modules/repository (#9489)
* Move create/fork repository from models to modules/repository

* fix wrong reference

* fix test

* fix test

* fix lint

* Fix DBContext

* remove duplicated TestMain

* fix lint

* fix conflicts
2020-01-12 20:11:17 +08:00
John Olheiser 6715677b2b Push to create repo (#8419)
* Refactor

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add push-create to SSH serv

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Cannot push for another user unless admin

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Get owner in case admin pushes for another user

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Set new repo ID in result

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update to service and use new org perms

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Move pushCreateRepo to services

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix import order

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Changes for @guillep2k

* Check owner (not user) in SSH
* Add basic tests for created repos (private, not empty)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-12-15 10:49:52 +08:00
Lunny Xiao 77730db257
Move repoWorkPool outside rename/transfer repository (#9086)
* Move repoWorkPool outside rename/transfer repository

* fix import

* Fix test
2019-12-06 12:00:50 +08:00
John Olheiser 62bcb2b7f1 Add avatar and issue labels to template repositories (#9149)
* Add avatar and issue labels

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix redundant if-err

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-11-25 13:17:51 +08:00
John Olheiser e84326aaec Add git hooks and webhooks to template repositories; move to services (#8926)
* Add git hooks and webhooks to template options

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update models/repo.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Add tooltip if the user can't edit git hooks

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Close repositories after copying git hooks

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Wording

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Restructure for services

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Return errors

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Move GenerateRepository to using a DBContext

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Wrap with models.WithTx

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Remove debug print

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Move if-error-delete-repo outside WithTx

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Return nil if no repo generated

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-11-24 12:57:52 -05:00
Lunny Xiao 21ae9838e0
Move transfer repository and rename repository on a service package and start action notification (#8573)
* move transfer repository and rename repository on a service package and start action notification

* remove unused codes

* fix lint

* fix bugs

* fix test

* fix test

* fix test

* fix lint

* update go mod and sum
2019-11-15 16:06:11 +08:00
John Olheiser 74a6add4d9 Template Repositories (#8768)
* Start work on templates

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Continue work

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix IsTemplate vs IsGenerated

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix tabs vs spaces

* Tabs vs Spaces

* Add templates to API & start adding tests

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix integration tests

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Remove unused User

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Move template tests to existing repos

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Minor re-check updates and cleanup

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* make fmt

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Test cleanup

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix optionalbool

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* make fmt

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Test fixes and icon change

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add new user and repo for tests

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix tests (finally)

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update meta repo with env variables

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Move generation to create page

Combine with repo create template
Modify API search to prioritize owner for repo

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix tests and coverage

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix swagger and JS lint

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix API searching for own private repos

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Change wording

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix repo search test. User had a private repo that didn't show up

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Another search test fix

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Clarify git content

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Feedback updates

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add topics WIP

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Finish adding topics

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update locale

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-11-11 23:15:29 +08:00
Lunny Xiao 9e85358777
Move some repositories' operations to a standalone service package (#8557)
* Move some repositories' operations to a standalone service package

* improve code

* remove unused codes

* add rollback when fork failed

* add repo when return
2019-10-26 14:54:11 +08:00