git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Bradley Wagner <bradley.wagner@hannonhill.com>
To: git@vger.kernel.org
Subject: Handling tags/branches after git-svn fetch during SVN to Git  conversion
Date: Wed, 7 Jul 2010 09:36:55 -0400	[thread overview]
Message-ID: <AANLkTim56UOYQJfX3M5Jpt0vXD8iTnkLuG68IjQG39Xn@mail.gmail.com> (raw)

I had a fairly complicated config for my SVN to Git migration with
multiple branch and tag locations. Therefore, I had to break up the
"git svn clone" because I didn't know how to pass multiple branch
locations to "git svn clone":

1. git svn init
2. Update .git/config with branch/tag locations
[svn-remote "svn"]
        url = file:///Users/Developers/git_transition/svn_repo
        fetch = project/trunk:refs/remotes/svn/trunk
        branches =
project/branches/{feature1-branch,feature2-branch}:refs/remotes/svn/*
        branches =
project/branches/{6.x,5.x,4.x,3.x,archive}/*:refs/remotes/svn/*
        tags = project/tags/{3.7.x,4.x,5.x,6.x,old-releases}/*:refs/remotes/svn/tags/*
3. git svn -A/path/to/mappings fetch

Do I need to convert these remote tags/branches into local Git
tags/branches before pushing them to my remote Git repo or is there a
way to push remote branches directly to my remote Git repo?

The command that someone else told me was "git checkout -b
<local_branch_name> <remote_branch_name>". Though, I've seen other
places mention different strategies for converting the branches.

The script I devised to convert the tags does this for each tags
folder to maintain the original commit date, author, and commit
message:

git for-each-ref --format="%(refname)" refs/remotes/svn/tags/6.x |
grep -v @ | while read tag; do GIT_COMMITTER_DATE="$(git log -1
--pretty=format:"%ad" "$tag")" GIT_COMMITTER_EMAIL="$(git log -1
--pretty=format:"%ce" "$tag")" GIT_COMMITTER_NAME="$(git log -1
--pretty=format:"%cn" "$tag")" git tag -m "$(git log -1
--pretty=format:"%s%n%b" "$tag")" ${tag#refs/remotes/svn/tags/6.x/}
"$tag"; done

Please let me know if this is correct.

Thanks!

             reply	other threads:[~2010-07-07 13:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 13:36 Bradley Wagner [this message]
2010-07-09  2:33 ` Handling tags/branches after git-svn fetch during SVN to Git conversion Bradley Wagner
2010-07-09  2:54 ` Jacob Helwig
2010-07-09  3:01   ` Bradley Wagner
2010-07-09  3:09     ` Jacob Helwig
2010-07-09  3:18       ` Bradley Wagner
2010-07-09  3:34         ` Jacob Helwig

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=AANLkTim56UOYQJfX3M5Jpt0vXD8iTnkLuG68IjQG39Xn@mail.gmail.com \
    --to=bradley.wagner@hannonhill.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).