简体   繁体   English

移动SVN存储库后的git-svn?

[英]git-svn after an SVN repository is moved?

We recently moved our SVN server from one data center to another, and the IP of the server has changed. 我们最近将SVN服务器从一个数据中心移动到另一个数据中心,并且服务器的IP已经改变。 I used svn switch --relocate old_url new_url to update my actual working copy, and that was happy. 我使用svn switch --relocate old_url new_url来更新我的实际工作副本,这很开心。

However, I do most of my work in a local git version of the repository (using git-svn, obviously). 但是,我在存储库的本地git版本中完成了大部分工作(显然使用git-svn)。 After moving the SVN server, I updated the URL for the repo in .git/config , but when I try to use dcommit , I receive this error: 移动SVN服务器后,我在.git/config更新了repo的URL,但是当我尝试使用dcommit ,收到此错误:

Unable to determine upstream SVN information from HEAD history.
Perhaps the repository is empty. at /home/me/libexec/git-core/git-svn line 520.

What am I missing? 我错过了什么?

In general, this isn't something that git-svn supports directly. 一般来说,这不是git-svn直接支持的。 The biggest hurdle is that git-svn uses the "git-svn-id" (visible in the commit log for each commit) to uniquely identify commits from SVN -- and the SVN URL is part of this ID. 最大的障碍是git-svn使用“git-svn-id”(在每次提交的提交日志中可见)来唯一地标识来自SVN的提交 - 并且SVN URL是此ID的一部分。 If the URL changes, it pretty much invalidates all of your existing history. 如果网址发生变化,则几乎会使所有现有历史记录无效。

There are workarounds described here which look like they should work, but they aren't exactly simple and I haven't tried any of them myself. 有描述变通这里看起来像他们应该工作,但它们并不完全简单,我还没有尝试过任何人自己。

It's possible to do this with git-svn by cloning both repos, merging them, then rebuilding the git-svn metadata. 通过克隆repos,合并它们,然后重建git-svn元数据,可以使用git-svn完成此操作。

See my answer here . 在这里看到我的答案。

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

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