Python 如何在 MS Windows 操作系统上使用 Google 的 repo 工具?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14223302/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use Google's repo tool on MS Windows OS?
提问by 0x90
I installed git for windows and it works fine(e.g. use one of the following solutions Want to download a Git repository, what do I need (windows machine)?).
我为 Windows 安装了 git 并且它工作正常(例如,使用以下解决方案之一想要下载 Git 存储库,我需要什么(Windows 机器)?)。
I tried to use repoof googlebut it needs gpgand python 2.7. I installed both and it works fine the only problem is that reposcript use some unix oriented features such as symbolic links and fcntl. Is there any alternative code of repofor windows?
我尝试使用repogoogle,但它需要gpg和 python 2.7。我安装了两者,它运行良好,唯一的问题是repo脚本使用了一些面向 unix 的功能,例如符号链接和fcntl。repowindows有没有替代代码?
I couldn't found some native solution by google. if there is one I'll try to push it into google repo git repository or try to use it as is.
我找不到谷歌的一些本地解决方案。如果有的话,我会尝试将其推送到 google repo git 存储库中或尝试按原样使用它。
采纳答案by olibre
Yes, Google reposcript can be compliant with Windows. Follow the steps below.
是的,Googlerepo脚本可以与 Windows 兼容。请按照以下步骤操作。
But before, as Borealidsaid repoas not been ported on Windows. repo(forall.py) uses fcntlthat is not available on Windows (Unix only).
但在此之前,正如Borealid所说repo,没有在 Windows 上移植。repo( forall.py) 使用fcntl在 Windows 上不可用的(仅限 Unix)。
However there is Cygwinand its own pythonand gittools.
然而,有Cygwin的和自己的python和git工具。
If gitversion from MSysGit project for you or if you love your gitGUI that is based on MSysGit only, then follow the following steps. These steps ensure that Cygwin can create native NTFS symlinks. Else if the gitfrom Cygwin is sufficient, you do not have to do it. But it is better as setting CYGWIN=winsymlinks:nativetells Cygwin to use native NTFS symlinks instead of old Cygwin workaround.
如果gitMSysGit 项目的版本适合您,或者您喜欢git仅基于 MSysGit 的 GUI,请按照以下步骤操作。这些步骤确保Cygwin 可以创建本机 NTFS 符号链接。否则,如果git来自 Cygwin 的就足够了,您就不必这样做。但最好是设置CYGWIN=winsymlinks:native告诉 Cygwin 使用本机 NTFS 符号链接而不是旧的 Cygwin 解决方法。
- Use Windows Vista or later (or switch to Linux)
- Have Admin privileges
- Dowload and install Cygwin (32 or 64 bits)
- Select and install
pythonandgit(andgpgif you want) from Cygwin installer Set
CYGWIN=winsymlinks:nativein your Cygwin shell:export CYGWIN=winsymlinks:native mkdir NEW_DIR cd NEW_DIR repo init -u YOUR_URL repo sync -j 7
- 使用 Windows Vista 或更高版本(或切换到 Linux)
- 拥有管理员权限
- 下载并安装 Cygwin(32 或 64 位)
- 从 Cygwin 安装程序中选择并安装
python和git(gpg如果需要) CYGWIN=winsymlinks:native在你的 Cygwin shell 中设置:export CYGWIN=winsymlinks:native mkdir NEW_DIR cd NEW_DIR repo init -u YOUR_URL repo sync -j 7
(see also my other post)
(另见我的另一篇文章)
回答by Borealid
There is no native repofor Windows currently.
目前没有repo适用于 Windows 的本机。
You may use a Linux virtual machine or dual-boot, or work around the (relatively minor) issues caused by symlinks not functioning on your filesystem.
您可以使用 Linux 虚拟机或双引导,或者解决由符号链接在您的文件系统上不起作用引起的(相对较小的)问题。
Another option would be to just use gitdirectly instead of using the repoas a convenience wrapper - repois a support tool, and doesn't add any substantial power.
另一种选择是git直接使用而不是将repo用作方便的包装器 -repo是一种支持工具,并且不会增加任何实质性的功能。
回答by Asimov81
A working repo tool for windows is available here: https://github.com/esrlabs/git-repo
可在此处获得适用于 Windows 的工作回购工具:https: //github.com/esrlabs/git-repo
It requires Python 3+ and git 1.7.2+
它需要 Python 3+ 和 git 1.7.2+
Btw, the original forked repo version seems pretty old, so it might not contain all current functionalities.
顺便说一句,原始的分叉 repo 版本似乎很旧,因此它可能不包含所有当前功能。
回答by 0x90
There is an alternative for whoever has a choice to work with an alternative to repo, it's called gclient.
对于可以选择使用 repo 替代方案的人来说,有一种替代方案,称为gclient。
See Google's depot tools:
查看谷歌的仓库工具:
gclient: Meta-checkout tool managing both subversion and git checkouts. It is similar to repo tool except that it works on Linux, OS X, and Windows and supports both svn and git. On the other hand, gclient doesn't integrate any code review functionality.
gclient:元结帐工具,管理 subversion 和 git 结帐。它类似于 repo 工具,不同之处在于它适用于 Linux、OS X 和 Windows,并且支持 svn 和 git。另一方面,gclient 没有集成任何代码功能。

