推回购分支当地AOSP​​镜 [英] Pushing repo branch to local AOSP mirror

查看:212
本文介绍了推回购分支当地AOSP​​镜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建AOSP的一个新的分支(在我的机器),并将其推到一个本地镜像(在同一个局域网上的服务器上)。我无法找到回购的工具,它解释了如何做到这一点的文档。

I'm trying to create a new branch of the AOSP (on my development machine) and push it to a local mirror (on a server on the same LAN). I can't find documentation of the "repo" tool that explains how to do this.

我已经创建了AOSP源代码的镜像在我的服务器使用:

I've created a mirror of the AOSP source on my server using:

$ mkdir -p ~/aosp/mirror
$ cd ~/aosp/mirror
$ repo init -u https://android.googlesource.com/mirror/manifest --mirror

然后我同步时间在不同的计算机上:

Then I sync'd on a different computer:

 $ repo init -u <USERNAME>@<IP_OF_SERVER>:/home/<USERNAME>/aosp/mirror/platform/manifest.git -b android-4.2.2_1
 $ repo sync

到目前为止好。我使用-b Android的4.2.2_1因为我需要我的开发使用此版本的软糖作为基准。

So far so good. I'm using "-b android-4.2.2_1" because I need my development to use this version of JellyBean as a baseline.

然后,我创建一个使用回购启动一个新的分支:

Then I create a new branch using "repo start":

$ repo start my-branch-name --all

还是不错的。问题是,我无法弄清楚如何推这个分支到远程服务器。

Still good. The problem is, I can't figure out how to "push" this branch to the remote server.

当我这样做回购方式我明白了:

Manifest branch: refs/tags/android-4.2.2_r1
Manifest merge branch: android-4.2.2_r1
Manifest groups: all,-notdefault
----------------------------
Project: platform/abi/cpp
Mount path: /home/<username>/<project_name>/android/abi/cpp
Current revision: refs/tags/android-4.2.2_r1
Local Branches: 1 [my-branch-name]
---------------------------
....

当我尝试回购上传我得到:

no branches ready for upload

然后我试图回购FORALL -c混帐推AOSP我的分支,名为其中的确实的推动地方分支机构到每个远程仓库,但似乎这不是正确的方式来做到这一点。特别是,如果我尝试创建一个新的客户端,并尝试同步到分支这是行不通的。

I then tried repo forall -c "git push aosp my-branch-name" which does push the local branches to each remote repository, but it seems like this is not the proper way to do it. In particular, if I try creating a new client, and try syncing to the branch it doesn't work.

$ repo init -u <USERNAME>@<IP_OF_SERVER>:/home/<USERNAME>/aosp/mirror/platform/manifest.git -b my-branch-name
error: revision my-branch-name in manifests not found

什么是正确的方式来创建一个清单分支?

What is the proper way to create a "Manifest branch"?

推荐答案

回购启动基于当前的上游分支命令创建一个本地分支。运行回购上传将上传的审查目前已签出的分支任何本地提交到由清单文件中列出的格里特服务器托管上游分支。如果你想要做俯卧撑的类型不匹配这种使用情况,你将不得不使用为推动基本Git命令。您仍然可以使用回购启动虽然(但你没有)。

The repo start command creates a local branch based on the current upstream branch. Running repo upload will upload any local commits on the currently checked-out branch for review to the upstream branch hosted by the Gerrit server listed in the manifest file. If the type of push you want to do doesn't match this use case you'll have to use the underlying Git commands for the pushing. You can still use repo start though (but you don't have to).

要创建清单分支,回购启动回购上传是没有用的。不像其他的控释片的回购管理,你应该让所有的更改对默认分支,回购检查出你的清单混帐。然后,使用纯Git命令把你的变化。

To create a manifest branch, repo start and repo upload aren't useful. Unlike other gits that Repo manages, you should make all changes to the manifest git on the default branch which Repo checks out for you. Then, use plain Git commands to push your changes.

下面的例子演示如何创建一个新的分支清单名为 mybranch ,等同于当前的上行。

The following example shows how to create a new manifest branch called mybranch, identical to the current upstream.

cd .repo/manifests
git push origin default:refs/heads/mybranch

现在,这本身并不是非常有用的,因为你的清单中的内容是相同的上游分支 - 我们刚刚克隆了明显的一个分支,所以当你的可以的运行

Now, this by itself isn't very useful since the contents of your manifest is identical to the upstream branch – we've just cloned that branch of the manifest so while you can run

repo init -u ssh://git.example.com/platform/manifest -b mybranch

结果将是相同的您开始使用什么:

the results will be identical to what you started with:

repo init -u ssh://git.example.com/platform/manifest -b android-4.2.2_1

有关你的镜子是有用的,你也有分支,在清单中列出的每个混帐,使你得到一个分支服务器上,您可以进行更改。

For your mirror to be useful you also have to branch each git listed in the manifest so that you get a branch on your server where you can make changes.

从理论上讲,你可以更改您从上游下载同一个分支,但是当你试图从上游的下一次同步,将创建一个烂摊子。不要做。

Theoretically you could make changes to the same branches that you downloaded from your upstream, but that would create a mess when you attempt to sync from the upstream the next time. Don't do that.

要在服务器上创建分支,你可以遵循相同的模式作为清单:

To create branches on the server you can follow the same pattern as for the manifest:

cd build
git push ssh://git.example.com/platform/build HEAD:refs/heads/mybranch

请注意使用的头,对目前已签出提交的符号名。这样做的每一个Git是单调乏味的,所以使用回购FORALL 命令:

Note the use of HEAD, the symbolic name of the currently checked out commit. Doing this for each and every git is tedious, so use the repo forall command:

repo forall -c 'git push aosp HEAD:refs/heads/mybranch'

请注意远程名字是从清单混帐(IIRC)的不同。

Note that the remote name is different from the manifest git (IIRC).

环境变量的可供回购FORALL 运行命令(<$ C列表,请参阅回购帮助FORALL $ C> REPO_PROJECT , $ REPO_LREV $ REPO_RREV 可能是最有用的)。

See repo help forall for a list of environment variables available for commands run by repo forall (REPO_PROJECT, $REPO_LREV, and $REPO_RREV are probably the most useful ones).

这很容易搞砸了与回购FORALL ,所以使它成为一个很好的习惯,prePEND与您的命令回声第一个具有的将被执行的回显到终端。如果你对结果满意,删除回声运行命令真的。

It's easy to screw up with repo forall, so make it a good habit to prepend your command with echo first to have the commands that would have been run echoed to your terminal. If you're happy with the results, remove echo to run the commands for real.

现在你将有一个 mybranch 分公司所有的控释片,包括清单。剩下的是改变清单以便

By now you'll have a mybranch branch in all your gits, including the manifest. What remains is to change the manifest so that

repo init -u ssh://git.example.com/platform/manifest -b mybranch

实际上将检查出 mybranch 中的所有控释片。

cd .repo/manifests
vi default.xml
[ Change the default revision from refs/tags/android-4.2.2_1
  or whatever it says to 'mybranch'. ]
git commit -a -m 'Changed default revision to mybranch.'
git push origin default:refs/heads/mybranch

请注意,所有控释片不一定使用默认版本(刚刚更改为 mybranch )。这也可能是为Android-4.2.2_1清单分支的情况,但在其他情况下,一些控释片将不使用默认的修订版,而是用自己的版本属性来覆盖它。这是完全正常的,但它会要求你进行其他明显变化。

Note that all gits don't necessarily use the default revision (which you just changed to mybranch). It's probably the case for the android-4.2.2_1 manifest branch, but in other cases some gits won't use the default revision but instead override it with their own revision attribute. That's perfectly fine, but it'll require you to make additional manifest changes.

这篇关于推回购分支当地AOSP​​镜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆