git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Hocevar <sam@zoy.org>
To: git@vger.kernel.org
Subject: git-svn equivalent to "svn switch --relocate"
Date: Tue, 17 Jun 2008 18:06:02 +0200	[thread overview]
Message-ID: <20080617160602.GB29897@zoy.org> (raw)

   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.

             reply	other threads:[~2008-06-17 16:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 16:06 Sam Hocevar [this message]
2008-06-17 21:42 ` git-svn equivalent to "svn switch --relocate" Steven Walter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080617160602.GB29897@zoy.org \
    --to=sam@zoy.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).