5

We recently moved our SVN server from one data center to another, and the IP of the server has changed. I used svn switch --relocate old_url new_url to update my actual working copy, and that was happy.

However, I do most of my work in a local git version of the repository (using git-svn, obviously). 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:

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?

codekoala
  • 715
  • 11
  • 17

2 Answers2

4

In general, this isn't something that git-svn supports directly. 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. 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.

Dan Moulding
  • 211,373
  • 23
  • 97
  • 98
  • Thanks. I had feared that this would be the case, but I'm not too worried about losing my work. I can always pull in my branches after re-importing the SVN stuff. – codekoala Jan 14 '11 at 19:51
  • 1
    I have tried the workaround described in the link at [GitSvnSwitch](https://git.wiki.kernel.org/index.php/GitSvnSwitch) and it did work for me. – ldav1s Jan 15 '11 at 03:45
  • Yes, using the same `url` and `rewriteRoot` in my `.git/config` did the trick for me too! Fantastic! – codekoala Jan 17 '11 at 02:59
0

It's possible to do this with git-svn by cloning both repos, merging them, then rebuilding the git-svn metadata.

See my answer here.

Community
  • 1
  • 1
Ben Challenor
  • 3,365
  • 1
  • 35
  • 35