简体   繁体   English

如何为TeamCity集成git和svn?

[英]How can I integrate git and svn for TeamCity?

Currently: 目前:

  1. TeamCity is setup to build from SVN. TeamCity设置为从SVN构建。
  2. TeamCity is setup to build from GIT. TeamCity设置为从GIT构建。
    • Git bare repo on the TC server (not on agent) 在TC服务器上的Git裸仓(不在代理上)

I'm manually (from my repo, which has the svn ref) rebasing (git spull - standard alias) and checking in to the bare git repo on the TC server (git push). 我是手动(从我的repo,它有svn ref)rebasing(git spull - 标准别名)并检入TC服务器上的裸git repo(git push)。

As we're in the process of migrating to git (assuming we can figure out how!) we have checkins from both svn and git. 因为我们正在迁移到git(假设我们可以弄清楚如何!),我们有来自svn和git的签名。

One thing to note is that the svn repo will need to be updated even after everyone stops checking in to it per company policy. 需要注意的一点是,即使每个公司都按照公司政策停止检查,也需要更新svn repo。 (So after a successful build, we'll trigger a "git spush") (所以在成功构建之后,我们将触发“git spush”)

What would be the setup for TeamCity? TeamCity的设置是什么?

  1. Worst case scenario is that I manually pull from svn (until everyone is off svn) and rebase the bare git repo. 最糟糕的情况是我从svn手动拉(直到每个人都关闭svn)并重新绑定裸git仓库。 This would continue after everyone has migrated, per company policy described above 根据上述公司政策,每个人迁移后都会继续这样做
  2. Another way might be to add the svn ref to the bare repo and write a script that will call "git spull" every hour or so via TC. 另一种方法可能是将svn ref添加到裸存储库并编写一个脚本,通过TC每小时左右调用一次“git spull”。
    • Could be trouble if there are merge conflicts 如果存在合并冲突可能会有麻烦
    • Will also need another config that will "git spush" after a successful build 还需要另一个配置,在成功构建后将“git spush”
  3. Yet another way, might be to have a svn plugin to trigger the "svn spull" after every checkin in svn and drop that off in a special branch with a manual merge step (slightly better than option 1 and removes the worst case for option 2) 另一种方式,可能是在svn中每次签入后都有一个svn插件来触发“svn spull”,并在一个特殊的分支中通过手动合并步骤将其删除(略好于选项1并删除选项2的最坏情况) )

Any other ways? 还有其他方法吗? Anyone doing something similar? 有人做类似的事吗?

Darn it, I wish I found this blog earlier! 亲爱的,我希望我之前找到这个博客!

http://www.tfnico.com/presentations/git-and-subversion http://www.tfnico.com/presentations/git-and-subversion

I've come to similar conclusions, but wasted 5-6 hours. 我得出了类似的结论,但浪费了5-6个小时。

First, I would be very interested to read how you accomplished your migration once it's completed. 首先,我非常有兴趣了解一旦完成迁移后如何完成迁移。 A blog post or something writing up your experiences, documenting the problems you hit, would be a fantastic resource. 撰写博客文章或撰写您的经历,记录您遇到的问题,将是一个很棒的资源。 I'm thinking of starting the same migration at my place of work. 我正在考虑在我的工作地点开始相同的迁移。

I think option 2 sounds most sensible, but I'm not sure why you would need to set up a pull operation as well as a push. 我认为选项2听起来最明智, 我不确定为什么你需要设置拉动操作以及推动操作。 Why not just continue with the successful builds being pushed to SVN to keep that in sync with Git? 为什么不继续将成功的构建推送到SVN以保持与Git同步?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM