git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-svn equivalent to "svn switch --relocate"
@ 2008-06-17 16:06 Sam Hocevar
  2008-06-17 21:42 ` Steven Walter
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Hocevar @ 2008-06-17 16:06 UTC (permalink / raw)
  To: git

   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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: git-svn equivalent to "svn switch --relocate"
  2008-06-17 16:06 git-svn equivalent to "svn switch --relocate" Sam Hocevar
@ 2008-06-17 21:42 ` Steven Walter
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Walter @ 2008-06-17 21:42 UTC (permalink / raw)
  To: Sam Hocevar; +Cc: git

On Tue, Jun 17, 2008 at 12:06 PM, Sam Hocevar <sam@zoy.org> wrote:
>   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.

It is not so hard to work around this problem.  After you run
filter-branch, make sure the ref used by git-svn in refs/remotes
points to the new (altered) hash.  Then, delete the .git/svn/<remote>
directory corresponding to the svn-remote you changed (trunk,
probably).  When you next run "git svn fetch", git-svn will regenerate
its revmap using the new hash, and everything should be peachy after
that.
-- 
-Steven Walter <stevenrwalter@gmail.com>
"A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects."
 -Robert Heinlein

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-17 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17 16:06 git-svn equivalent to "svn switch --relocate" Sam Hocevar
2008-06-17 21:42 ` Steven Walter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).