50

The Android source is a large hierarchy of git repositories. They are managed by a custom script called repo. Repo determines which git repositories to manage using a manifest.xml. The manifest.xml of Android is hosted in a git repository along with all the other git repositories.

How is this repository managed in Android? Specifically how are the different branches and the different files hosted in each branch organised?

4

2 に答える 2

66

まず、repo init は.repoディレクトリを作成し、git リポジトリhttps://android.googlesource.com/tools/repoをにクローン.repo/repoし、オプションで指定された git リポジトリ-uを のベア リポジトリにクローンします.repo/manifests.git。その後、ディレクトリを作成し、からへ.repo/manifestsのシンボリック リンクを作成して、それを git リポジトリに変換します。次に、 で指定されたブランチをチェックアウトし、デフォルトで で指定されたファイル (オプション) を指すシンボリック リンクを作成します。 .repo/manifests/.git.repo/manifests.git-b.repo/manifest.xml-m.repo/manifests.repo/manifests/default.xml

おおよそ次のとおりです。

  repo init -u $URL -b $BRANCH -m $MANIFEST
  --------------------
  mkdir .repo; CD.レポ
  git クローン https://android.googlesource.com/tools/repo
  git clone --bare $URL manifests.git
  mkdir -p manifests/.git; CD マニフェスト/.git
  for i in ../../manifests.git/*; do ln -s $ı .; 終わり
  CD ..
  git checkout $BRANCH -- .
  CD ..
  ln -s manifests/$MANIFEST manifest.xml  

実際に何が起こっているかを追跡できますrepo --trace init ...

次に、repo syncはと.repo/projectsの各プロジェクトに対してgit リポジトリのクローンを作成し、対応するベア リポジトリへのシンボリック リンクを持つ作業ディレクトリを作成し、マニフェストで指定されたブランチをチェックアウトし、更新します。プロジェクトがすでに存在する場合は少し異なり、基本的に.manifest.xmllocal_manifest.xml.git.repo/project.listgit pull --rebase

于 2012-08-08T18:04:34.080 に答える
9

リポジトリのルートには「.repo」という名前の隠しディレクトリがあり、その中には「manifests」という名前の git プロジェクトがあり、通常は「default.xml」という名前のファイルが含まれています。このファイルには、すべてのプロジェクトに関する情報と、関連する git リポジトリの場所に関する情報が含まれています。このファイルもバージョン管理されているため、「repo init -b XYZ」コマンドを使用すると元に戻り、ヘッドと比較して git プロジェクトを追加/削除した可能性のある古いブランチに戻ることができます。

マニフェスト形式を説明する repo git repo ドキュメントへのリンクを次に示します。

https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.txt

于 2012-05-11T09:10:53.613 に答える