git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-svn equivalent to "svn switch --relocate"

From
Sam Hocevar <sam@zoy.org>
Date
Jun 17, 2008, 16:06 UTC
Message-ID
<20080617160602.GB29897@zoy.org>
   I know this has been addressed a few times, but since I haven't found
any reasonable way to relocate a git-svn repository (after a protocol
change, or a server name change) I thought I'd share how I did it.
   Step 1 is to edit ".git/config" and modify the "url = " line so
that it reflects the new repository address. For instance:

- url = http://svn.gnome.org/svn/gimp + url = svn+ssh://svn.gnome.org/svn/gimp

   From now on, git-svn will basically stop working, because the
"git-svn-id:" lines in the commit logs will no longer match its
configuration. And git-filter-branch is of no use here either, because
it will change the md5sum of each commit, and git-svn will no longer be
able to track the commits.
   Step 2 is therefore to temporarily hack git-svn to make it think
the commit messages do use the new URL. This is done at the end of the
"extract_metadata" subroutine:
 		($rev, $uuid) = ($id =~/^\s*git-svn-id:\s(\d+)\@([a-f\d\-]+)/);
 	}
+	$url =~ s|http://svn.gnome.org/svn/gimp/|svn+ssh://svn.gnome.org/svn/gimp/|;
 	return ($url, $rev, $uuid);
 }
   This will usually be needed only until the next SVN commit is merged
and the git-svn tree is rebased.
   Hope this can help a few. Unfortunately I don't understand the
git-svn source code well enough to work on a cleaner way to do that.
Cheers,
-- 
Sam.
Next: Steven Walter
Message 1 of 2 in “git-svn equivalent to "svn switch --relocate"”
  1. Sam HocevarJun 17, 2008
  2. Steven WalterJun 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.