2021-01-28 17:57:58 -07:00
|
|
|
|
---
|
|
|
|
|
date: "2019-04-15T17:29:00+08:00"
|
|
|
|
|
title: "遷移介面"
|
|
|
|
|
slug: "migrations-interfaces"
|
2023-04-04 07:47:31 -06:00
|
|
|
|
weight: 55
|
2021-01-28 17:57:58 -07:00
|
|
|
|
toc: false
|
|
|
|
|
draft: false
|
Refactor docs (#23752)
This was intended to be a small followup for
https://github.com/go-gitea/gitea/pull/23712, but...here we are.
1. Our docs currently use `slug` as the entire URL, which makes
refactoring tricky (see https://github.com/go-gitea/gitea/pull/23712).
Instead, this PR attempts to make future refactoring easier by using
slugs as an extension of the section. (Hugo terminology)
- What the above boils down to is this PR attempts to use directory
organization as URL management. e.g. `usage/comparison.en-us.md` ->
`en-us/usage/comparison/`, `usage/packages/overview.en-us.md` ->
`en-us/usage/packages/overview/`
- Technically we could even remove `slug`, as Hugo defaults to using
filename, however at least with this PR it means `slug` only needs to be
the name for the **current file** rather than an entire URL
2. This PR adds appropriate aliases (redirects) for pages, so anything
on the internet that links to our docs should hopefully not break.
3. A minor nit I've had for a while, renaming `seek-help` to `support`.
It's a minor thing, but `seek-help` has a strange connotation to it.
4. The commits are split such that you can review the first which is the
"actual" change, and the second is added redirects so that the first
doesn't break links elsewhere.
---------
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-04-27 21:33:41 -06:00
|
|
|
|
aliases:
|
|
|
|
|
- /zh-tw/migrations-interfaces
|
2021-01-28 17:57:58 -07:00
|
|
|
|
menu:
|
|
|
|
|
sidebar:
|
2023-03-23 09:18:24 -06:00
|
|
|
|
parent: "development"
|
2021-01-28 17:57:58 -07:00
|
|
|
|
name: "遷移介面"
|
|
|
|
|
weight: 55
|
|
|
|
|
identifier: "migrations-interfaces"
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# 遷移功能
|
|
|
|
|
|
|
|
|
|
完整的遷移從 Gitea 1.9.0 開始提供。它定義了兩個介面用來從其它 Git 託管平臺遷移儲存庫資料到 Gitea,未來或許會提供遷移到其它 git 託管平臺。
|
|
|
|
|
目前已實作了從 Github, Gitlab 和其它 Gitea 遷移資料。
|
|
|
|
|
|
2022-07-27 19:22:47 -06:00
|
|
|
|
Gitea 定義了一些基本物件於套件 [modules/migration](https://github.com/go-gitea/gitea/tree/master/modules/migration)。
|
2021-01-28 17:57:58 -07:00
|
|
|
|
分別是 `Repository`, `Milestone`, `Release`, `ReleaseAsset`, `Label`, `Issue`, `Comment`, `PullRequest`, `Reaction`, `Review`, `ReviewComment`。
|
|
|
|
|
|
|
|
|
|
## Downloader 介面
|
|
|
|
|
|
|
|
|
|
從新的 Git 託管平臺遷移,有兩個新的步驟。
|
|
|
|
|
|
|
|
|
|
- 您必須實作一個 `Downloader`,它用來取得儲存庫資訊。
|
|
|
|
|
- 您必須實作一個 `DownloaderFactory`,它用來偵測 URL 是否符合並建立上述的 `Downloader`。
|
|
|
|
|
- 您需要在 `init()` 透過 `RegisterDownloaderFactory` 來註冊 `DownloaderFactory`。
|
|
|
|
|
|
2023-06-08 01:35:55 -06:00
|
|
|
|
您可以在 [downloader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/downloader.go) 中找到這些介面。
|
2021-01-28 17:57:58 -07:00
|
|
|
|
|
|
|
|
|
## Uploader 介面
|
|
|
|
|
|
|
|
|
|
目前只有 `GiteaLocalUploader` 被實作出來,所以我們只能通過 `Uploader` 儲存已下載的資料到本地的 Gitea 實例。
|
|
|
|
|
目前尚未支援其它 Uploader。
|
|
|
|
|
|
2023-06-08 01:35:55 -06:00
|
|
|
|
您可以在 [uploader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/uploader.go) 中找到這些介面。
|