Git-svn 和 Eclipse?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5655839/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 10:36:31  来源:igfitidea点击:

Git-svn and Eclipse?

eclipsegiteclipse-plugingit-svn

提问by Konrad Garus

Is there a plugin for Eclipse for git-svn? I'm looking for a way to handle the SVN repo with Git (for fast branch switching etc.)

有 Eclipse 的 git-svn 插件吗?我正在寻找一种使用 Git 处理 SVN 存储库的方法(用于快速分支切换等)

回答by ztatic

It does not look like there is a Git plugin for Eclipse that supports git-svn yet.

Eclipse 似乎还没有支持 git-svn 的 Git 插件。

EGitappears to be the most active and popular Git plugin for Eclipse at the moment and it does not support git-svn, but there isn't anything stopping you from using EGit with Eclipse and interacting with git-svn via command line (or via tortoise gitfor example).

EGit似乎是目前最活跃和最受欢迎的 Eclipse 的 Git 插件,它不支持 git-svn,但是没有什么可以阻止您在 Eclipse 中使用 EGit 并通过命令行(或通过例如乌龟 git)。

Eclipse bug 315264is the EGit bug for supporting git-svn, and it looks like something that the maintainers of EGit are willing implement, but they have other priorities atm. So make sure you vote for this bug if you want the feature.

Eclipse 错误 315264是支持 git-svn 的 EGit 错误,看起来 EGit 的维护者愿意实现的东西,但他们有其他优先级 atm。所以如果你想要这个功能,请确保你投票支持这个错误。

回答by vadishev

EGitis the only Git plugin for Eclipse at the moment. It doesn't support git-svn. But there is a way to make EGit work with your Subversion repository and this approach works well with any other Git client.

EGit是目前唯一适用于 Eclipse 的 Git 插件。它不支持 git-svn。但是有一种方法可以让 EGit 与您的 Subversion 存储库一起使用,并且这种方法适用于任何其他 Git 客户端。

SubGitis the server-side solution that enables Git access to your Subversion repositories as well as Subversion access to Git repositories. You may refer to SubGit documenationfor more details, but in general they are quite straightforward:

SubGit是服务器端解决方案,允许 Git 访问您的 Subversion 存储库以及 Subversion 访问 Git 存储库。您可以参考SubGit 文档以获取更多详细信息,但总的来说,它们非常简单:

$ subgit configure --layout auto $SVN_URL $GIT_REPO
# Adjust $GIT_REPO/subgit/config
#     to specify your branches, tags and other settings
# Adjust $GIT_REPO/subgit/authors.txt 
#     to introduce svn author names to their git counterparts
# Adjust $GIT_REPO/subgit/passwd
#     in case you have no SVN credentials cached on your machine
$ subgit install $GIT_REPO
$ ... translating ... a little git is gonna born right here ... 
$ TRANSLATION SUCCESSFUL

After that:

在那之后:

  1. You have Git repository at $GIT_REPO synchronized with SVN repository at $SVN_URL; this sync is reliably bi-directional, i.e. both SVN and Git repositories remain writable and SubGit takes care of changes from both sides.

  2. SubGit has installed hooks into $GIT_REPO/hooks directory which are triggered on every git pushto that repository.

  3. SubGit polls SVN repository in order to fetch new revisions.

  1. 您在 $GIT_REPO 的 Git 存储库与 $SVN_URL 的 SVN 存储库同步;这种同步是可靠的双向同步,即 SVN 和 Git 存储库都保持可写,SubGit 负责处理双方的更改。

  2. SubGit 已将钩子安装到 $GIT_REPO/hooks 目录中,这些钩子在每个git push到该存储库时都会触发。

  3. SubGit 轮询 SVN 存储库以获取新修订。

Please note that your teammates may use the same mirror for sending their changes to Subversion repository. In this case you should setup Git server, fortunately, SubGit supports virtually every Git server available at the moment:

请注意,您的团队成员可能会使用相同的镜像将他们的更改发送到 Subversion 存储库。在这种情况下,您应该设置 Git 服务器,幸运的是,SubGit 目前支持几乎所有可用的 Git 服务器:

  • 带有git-http-backend、GitLab、Gitosis、Gitolite 的Apache HTTP 服务器:开箱即用;
  • Atlassian Bitbucket Server:在这种情况下,您可以使用基于 SubGit 引擎构建的SVN Mirror 插件
  • Gerrit:在这种情况下,您需要为 Gerrit安装SubGit 插件

Disclaimer: I'm SubGit developer; SubGit is commercial software with free options for small teams, Open Source and Academic projects.

免责声明:我是 SubGit 开发人员;SubGit 是商业软件,可为小型团队、开源和学术项目提供免费选项。

回答by Kirill Rakhman

Although this question is 4 years old, I thought I would share my recently found workaround:

虽然这个问题已经有 4 年历史了,但我想我会分享我最近发现的解决方法:

  1. Open "External Tools Configurations"(right next to "Run Configurations") and create a new "Program" configuration.
  2. For the working directory, choose your project from the workspace.
  3. Enter svn dcommitinto the arguments textfield.
  4. Duplicate the configuration and replace svn dcommitby svn rebase.
  1. 打开“外部工具配置”(在“运行配置”旁边)并创建一个新的“程序”配置。
  2. 对于工作目录,从工作区中选择您的项目。
  3. 输入svn dcommit参数文本字段。
  4. 复制配置并替换svn dcommitsvn rebase.

Now you can launch git svn dcommitand git svn rebasewith two clicks.

现在您可以启动git svn dcommitgit svn rebase两次点击。