summaryrefslogtreecommitdiffstats
path: root/modules/migrations
Commit message (Collapse)AuthorAgeFilesLines
* Move migrations into services and base into modules/migration (#17663)Lunny Xiao2021-11-1637-8306/+0
| | | | | | | * Move migrtions into services and base into modules/migration * Fix imports * Fix lint
* Decouple unit test, remove intermediate `unittestbridge` package (#17662)wxiaoguang2021-11-162-5/+4
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add migration from GitBucket (#16767)KN4CK3R2021-11-142-99/+182
| | | | | | | | | | | | | This PR adds [GitBucket](https://gitbucket.github.io/) as migration source. Supported: - Milestones - Issues - Pull Requests - Comments - Reviews - Labels There is no public usable instance so no integration tests added.
* Decouple unit test code from business code (#17623)wxiaoguang2021-11-123-4/+6
|
* Move webhook into models/webhook/ (#17579)Lunny Xiao2021-11-101-1/+2
|
* Avoid double imports (#17569)Gusted2021-11-081-3/+2
| | | | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Only allow webhook to send requests to allowed hosts (#17482)wxiaoguang2021-11-011-11/+1
|
* Upgrade go-github to v39 (#17437)Lunny Xiao2021-10-262-2/+2
|
* Multiple tokens support for migrating from github (#17134)Lunny Xiao2021-10-151-83/+129
| | | | | | | | | * multiple tokens support for migrating from github * improve code and token description * Fix bug * Add comment for get client
* Remove heads pointing to missing old refs (#17076)99rgosse2021-10-082-0/+22
| | | | | Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* Move login related structs and functions to models/login (#17093)Lunny Xiao2021-09-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move login related structs and functions to models/login * Fix test * Fix lint * Fix lint * Fix lint of windows * Fix lint * Fix test * Fix test * Only load necessary fixtures when preparing unit tests envs * Fix lint * Fix test * Fix test * Fix error log * Fix error log * Fix error log * remove unnecessary change * fix error log * merge main branch
* refactor: move from io/ioutil to io and os package (#17109)Eng Zer Jun2021-09-221-10/+9
| | | | | | | | | The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Move db related basic functions to models/db (#17075)Lunny Xiao2021-09-194-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | * Move db related basic functions to models/db * Fix lint * Fix lint * Fix test * Fix lint * Fix lint * revert unnecessary change * Fix test * Fix wrong replace string * Use *Context * Correct committer spelling and fix wrong replaced words Co-authored-by: zeripath <art27@cantab.net>
* Fix bug of migrate comments which only fetch one page (#17055)Lunny Xiao2021-09-151-2/+7
| | | | | | | * Fix bug of migrate comments which only fetch one page * add next page to trace Co-authored-by: zeripath <art27@cantab.net>
* Make TestOneDevDownloadRepo work again & more resistant (#16987)65432021-09-081-12/+7
| | | | | * Update TestOneDevDownloadRepo since OneDev api changed * Use test functions for migrations
* Resolve TODO: Enable pagination on GiteaDownloader.GetComments() & update ↵65432021-09-062-41/+37
| | | | | | | another TODO (#16963) * Update TODO in migrations * Resolve TODO: enable pagination on GiteaDownloader.GetComments()
* Ignore review comment when ref commit is missed (#16905)Lunny Xiao2021-09-011-1/+2
|
* Gitlab Migrator: dont ignore reactions of last request (#16903)65432021-09-011-6/+12
| | | Fix bug related to early breaking when migrating reactions.
* Fix dump and restore respository (#16698)Lunny Xiao2021-08-302-2/+9
| | | | | | | | | | | * Fix dump and restore * return different error message for get commit * Fix missing delete release attachment when deleting repository * Fix ci and add some comments Co-authored-by: zeripath <art27@cantab.net>
* Add migrate from OneDev (#16356)KN4CK3R2021-08-2218-92/+926
| | | | | | | | | | | | | | * Use context to simplify logic. * Added migration from OneDev. This PR adds [OneDev](https://code.onedev.io/) as migration source. Supported: - [x] Milestones - [x] Issues - [x] Pull Requests - [x] Comments - [x] Reviews - [x] Labels
* Add proxy settings and support for migration and webhook (#16704)Lunny Xiao2021-08-184-7/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add proxy settings and support for migration and webhook * Fix default value * Add newline for example ini * Add lfs proxy support * Fix lint * Follow @zeripath's review * Fix git clone * Fix test * missgin http requests for proxy * use empty Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Refactored and fixed migration tests. (#16714)KN4CK3R2021-08-1710-485/+744
| | | Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Update issue_index to finish migration (#16685)65432021-08-131-0/+5
| | | | | * update issue_index to finish migration * One Func to RecalculateIssueIndexForRepo
* [API] generalize list header (#16551)65432021-08-121-2/+2
| | | | | | | | | | | | | * Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
* Upgrade github.com/google/go-github v32.1.0 -> v37.0.0 (#16661)65432021-08-102-157/+73
| | | | | * Upgrade github.com/google/go-github vv32.1.0 -> v37.0.0 * refactor: use GetX() func to reduce code
* Fix various documentation, user-facing, and source comment typos (#16367)luzpaz2021-07-086-6/+6
| | | | | * Fix various doc, user-facing, and source comment typos Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby`
* Make the github migration less rate limit waiting to get comment per page ↵Lunny Xiao2021-06-3013-53/+191
| | | | | | | | | | | | | | | from repository but not per issue (#16070) * Make the github migration less rate limit waiting to get comment per page from repository but not per issue * Fix lint * adjust Downloader interface * Fix missed reviews * Fix test * Remove unused struct
* Add Status Updates whilst Gitea migrations are occurring (#15076)zeripath2021-06-164-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add migrating message Signed-off-by: Andrew Thornton <art27@cantab.net> * simplify messenger Signed-off-by: Andrew Thornton <art27@cantab.net> * make messenger an interface Signed-off-by: Andrew Thornton <art27@cantab.net> * rename Signed-off-by: Andrew Thornton <art27@cantab.net> * prepare for merge Signed-off-by: Andrew Thornton <art27@cantab.net> * as per tech Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* small refactor for retry downloader (#16137)a10121127962021-06-131-134/+83
| | | Signed-off-by: a1012112796 <1012112796@qq.com>
* Fixed assert statements. (#16089)KN4CK3R2021-06-075-18/+18
|
* Copy git data from disk when restore repository (#16066)Lunny Xiao2021-06-043-6/+11
|
* Encrypt migration credentials at rest (#15895)Norwin2021-05-311-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | * encrypt migration credentials in task persistence Not sure this is the best approach, we could encrypt the entire `PayloadContent` instead. Also instead of clearing individual fields in payload content, we could just delete the task once it has (successfully) finished..? * remove credentials of past migrations * only run DB migration for completed tasks * fix binding * add omitempty * never serialize unencrypted credentials * fix import order Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix get tag when migration (#16014)Lunny Xiao2021-05-291-1/+1
| | | Co-authored-by: zeripath <art27@cantab.net>
* GitHub: migrate draft releases too (#15884)65432021-05-152-34/+31
| | | | | * GitHub: migrate draft releases too * refactor
* Close the gitrepo when deleting the repository (#15876)zeripath2021-05-141-0/+1
| | | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move restore repo to internal router and invoke from command to avoid open ↵Lunny Xiao2021-05-101-11/+41
| | | | | | | | | | | the same db file or queues files (#15790) * Move restore repo to internal router and invoke from command to avoid open the same db file or queues files * Follow @zeripath's review * set no timeout for resotre repo private request * make restore repo cancelable
* migration: github: if rate limit is not enabled, ignore it (#15490)65432021-04-151-0/+5
|
* Add LFS Migration and Mirror (#14726)KN4CK3R2021-04-083-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implemented LFS client. * Implemented scanning for pointer files. * Implemented downloading of lfs files. * Moved model-dependent code into services. * Removed models dependency. Added TryReadPointerFromBuffer. * Migrated code from service to module. * Centralised storage creation. * Removed dependency from models. * Moved ContentStore into modules. * Share structs between server and client. * Moved method to services. * Implemented lfs download on clone. * Implemented LFS sync on clone and mirror update. * Added form fields. * Updated templates. * Fixed condition. * Use alternate endpoint. * Added missing methods. * Fixed typo and make linter happy. * Detached pointer parser from gogit dependency. * Fixed TestGetLFSRange test. * Added context to support cancellation. * Use ReadFull to probably read more data. * Removed duplicated code from models. * Moved scan implementation into pointer_scanner_nogogit. * Changed method name. * Added comments. * Added more/specific log/error messages. * Embedded lfs.Pointer into models.LFSMetaObject. * Moved code from models to module. * Moved code from models to module. * Moved code from models to module. * Reduced pointer usage. * Embedded type. * Use promoted fields. * Fixed unexpected eof. * Added unit tests. * Implemented migration of local file paths. * Show an error on invalid LFS endpoints. * Hide settings if not used. * Added LFS info to mirror struct. * Fixed comment. * Check LFS endpoint. * Manage LFS settings from mirror page. * Fixed selector. * Adjusted selector. * Added more tests. * Added local filesystem migration test. * Fixed typo. * Reset settings. * Added special windows path handling. * Added unit test for HTTPClient. * Added unit test for BasicTransferAdapter. * Moved into util package. * Test if LFS endpoint is allowed. * Added support for git:// * Just use a static placeholder as the displayed url may be invalid. * Reverted to original code. * Added "Advanced Settings". * Updated wording. * Added discovery info link. * Implemented suggestion. * Fixed missing format parameter. * Added Pointer.IsValid(). * Always remove model on error. * Added suggestions. * Use channel instead of array. * Update routers/repo/migrate.go * fmt Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Add size to Save function (#15264)zeripath2021-04-031-1/+1
| | | | | Fix #15253 Signed-off-by: Andrew Thornton <art27@cantab.net>
* [Vendor] update gitea-sdk v0.14.0 (#15103)65432021-03-221-22/+0
| | | | | * upgraded code.gitea.io/sdk/gitea v0.13.2 => v0.14.0 * rm workaround
* Do not convert file path to lowercase (#15023)KN4CK3R2021-03-182-3/+7
| | | | | | | | * Do not convert file path to lowercase. * lint * Check against lowercase hostname.
* Ensure validation occurs on clone addresses too (#14994)zeripath2021-03-152-24/+71
| | | | | | | | | | | | | | | | | | | | | * Ensure validation occurs on clone addresses too Fix #14984 Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix api tests Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Move Workaround for #12675 into it's own function (#14922)65432021-03-081-7/+22
| | | | | * Move Workatround for #12675 into it's own function * use more reliable solution (as tea do)
* Re-enable import local paths after reversion from #13610 (#14925)zeripath2021-03-082-0/+19
| | | | | | | | | PR #13610 unfortunately disabled importing repositories from local paths. This PR restores this functionality. Fix #14700 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix a couple of CommentAsPatch issues. (#14804)zeripath2021-02-271-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | * CutDiffAroundLine makes the incorrect assumption that `---` and `+++` always represent part of the header of a diff. This PR adds a flag to its parsing to prevent this problem and adds a streaming parsing technique to CutDiffAroundLine using an io.pipe instead of just sending data to an unbounded buffer. Fix #14711 Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle unquoted comment patch files When making comment patches unfortunately the patch does not always quote the filename This makes the diff --git header ambiguous again. This PR finally adds handling for ambiguity in to parse patch Fix #14812 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add in testing for no error There is no way currently for CutDiffAroundLine in this test to cause an error however, it should still be tested. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix repo-restore bug with poster not replaced (#14759)Lunny Xiao2021-02-222-11/+28
| | | | | | | | | * Fix restore bug * Fix restore bug Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* Fix github download on migration (#14703)Lunny Xiao2021-02-181-4/+19
| | | | | | | * Fix github download on migration * Use Context for Client Co-authored-by: zeripath <art27@cantab.net>
* Fix rate limit bug when downloading assets on migrating from github (#14564)Lunny Xiao2021-02-071-0/+5
|
* Add support to migrate from gogs (#14342)65432021-01-2115-298/+860
| | | | | | | | | | | | | Add support to migrate gogs: * issues * comments * labels * milestones * wiki Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Add MirrorInterval to the API (#14163)Paul Barton2021-01-022-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added MirrorInterval to the API * Remove MirrorInterval from CreateRepository * Removed Duplicate UpdateMirror Function * Updated Error Logging * Update Log Message for is not Mirror Co-authored-by: 6543 <6543@obermui.de> * Delete Debug Statement that snuck in Co-authored-by: zeripath <art27@cantab.net> * Add Check for If Interval is too small * Output to API Call * Add Error Object when time is Less than Min Interval * Frequency Error Message Co-authored-by: zeripath <art27@cantab.net> * Allow Zero Mirror Interval Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>