Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

migrations.zh-tw.md 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ---
  2. date: "2019-04-15T17:29:00+08:00"
  3. title: "遷移介面"
  4. slug: "migrations-interfaces"
  5. weight: 30
  6. toc: false
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "developers"
  11. name: "遷移介面"
  12. weight: 55
  13. identifier: "migrations-interfaces"
  14. ---
  15. # 遷移功能
  16. 完整的遷移從 Gitea 1.9.0 開始提供。它定義了兩個介面用來從其它 Git 託管平臺遷移儲存庫資料到 Gitea,未來或許會提供遷移到其它 git 託管平臺。
  17. 目前已實作了從 Github, Gitlab 和其它 Gitea 遷移資料。
  18. Gitea 定義了一些基本物件於套件 [modules/migration](https://github.com/go-gitea/gitea/tree/master/modules/migration)。
  19. 分別是 `Repository`, `Milestone`, `Release`, `ReleaseAsset`, `Label`, `Issue`, `Comment`, `PullRequest`, `Reaction`, `Review`, `ReviewComment`。
  20. ## Downloader 介面
  21. 從新的 Git 託管平臺遷移,有兩個新的步驟。
  22. - 您必須實作一個 `Downloader`,它用來取得儲存庫資訊。
  23. - 您必須實作一個 `DownloaderFactory`,它用來偵測 URL 是否符合並建立上述的 `Downloader`。
  24. - 您需要在 `init()` 透過 `RegisterDownloaderFactory` 來註冊 `DownloaderFactory`。
  25. 您可以在 [downloader.go](https://github.com/go-gitea/gitea/blob/master/modules/migration/downloader.go) 中找到這些介面。
  26. ## Uploader 介面
  27. 目前只有 `GiteaLocalUploader` 被實作出來,所以我們只能通過 `Uploader` 儲存已下載的資料到本地的 Gitea 實例。
  28. 目前尚未支援其它 Uploader。
  29. 您可以在 [uploader.go](https://github.com/go-gitea/gitea/blob/master/modules/migration/uploader.go) 中找到這些介面。