Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Problem

I want to clone an svn repo with git-svn. The problem is the subversion repository changed layouts at r1235.

Specifics

From revision 1 to 1234, foo used the standard svn folder layout with:

  • /trunk/src
  • /tags/version/src

At revision 1235, the author added bar to the repo. To do so they restructured the master repository making the folder layout look like this:

  • /trunk/foo/src
  • /trunk/bar/src
  • /tags/version/foo/src
  • /tags/version/bar/src

Goal

I want a new git repository that has the history of foo as if it was never rearranged to include bar.

Relevant Documentation

Working with non standard layouts is discussed in git-svn's documentation.

If the entire history in unnecessary (or if I just want bar), I can get what I want from r1235 on:

  • git svn init --stdlayout http://path.to/repo
  • edit repo/.git/config adding /foo to relevant paths (or /bar)

`

[svn-remote "svn"]
   url = http://path.to/repo
   fetch = trunk/foo:refs/remotes/trunk
   branches = branches/*/foo:refs/remotes/*
   tags = tags/*/foo:refs/remotes/tags/*

`

  • git svn fetch -r 1235:HEAD

My attempts

  • git svn clone -r 1:1234 --stdlayout http://path.to/repo
  • edit repo/.git/config as above
  • git svn fetch -r 1235:HEAD

Result

The last command seems to succeed because r1235 - HEAD get downloaded. However, git log only shows commits up to 1234. The working directory also seems to be the old revision.

share|improve this question
2  
You have done it. You just forgot to check out the latest revision; git svn fetch does not do that. –  Jan Hudec Jan 23 '13 at 9:00

1 Answer 1

up vote 0 down vote accepted

You did just git svn fetch, so you now have to check out the latest revision.

Any of git svn rebase (hm, I am least certain with this one after the path change, but normally it's what you use; it includes fetch), git reset --hard trunk (forcibly discards local changes), git rebase trunk (re-applies committed local changes) or git merge --ff-only trunk (check there are no local changes) should do and since you don't have local changes yet are equivalent.

share|improve this answer
    
Doh! That was it. git reset trunk did it! git svn rebase failed with an error I have since forgotten. –  Cameron Tacklind Jan 24 '13 at 1:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.