Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: Unable to determine upstream SVN information from HEAD history

Tags:

git

git-svn

I've been successfully using git-svn to connect to my svn trunk for some time. I initially setup my repo by doing this:

git svn clone -s http://domain.com/svn/name-of-repo

I've had this setup for quite a while (maybe close to a year) and hadn't had problems, most likely because everything I do is on a local git branch, that I eventually merge back into my master branch, and commit back to the svn trunk.

Recently, I've needed to start committing some changes to another branch in the same svn repo, http://domain.com/svn/name-of-repo/branches/demo.

I was able to fetch from that branch once by editing my .git/config file and adding these lines:

[svn-remote "svndemo"]
    url = http://domain.com/svn/name-of-repo/branches/demo
    commiturl = http://domain.com/svn/name-of-repo/branches/demo
    fetch = :refs/remotes/git-svn-demo

Then I ran the following command to grab the demo branch, starting at revision 4034:

git svn fetch svndemo -r 4034 

So now I have a new remote branch called remotes/git-svn-demo. From that I created a feature branch:

git checkout -b svndemo-local remotes/git-svn-demo

That grabbed what I needed, so I made the changes I had to make, committed to my local branch, then tried to run "git svn fetch && git svn rebase". Both returned errors:

Unable to determine upstream SVN information from working tree history

And that is where I am stuck. I've looked around SO, and other sites (Google) but hadn't found a solution aside from "git-svn clone the repo again, and start over" which isn't ideal.

I've looked at my .git/svn/refs/remotes/git-svn-demo/unhandled.log and compared it to my .git/svn/refs/remotes/trunk/unhandled.log, and there's nothing significantly different about them.

I also looked at the commit message that came down from the initial fetch of this remote branch, and it include the git-svn-id information in it.

blah blah blah, this is the commit message, blah blah blah

git-svn-id: http://domain.com/svn/name-of-repo/branches/demo@4034 e6edf6fb-f266-4316-afb4-e53d95876a76

I'd love to hear a fresh idea on this one.

like image 237
Carl Avatar asked Nov 14 '22 19:11

Carl


1 Answers

To access svn branches you don't need to add a new svn remote. When you have set up your git svn clone using the -s (standard) option git also tracked all the branches defined under branches.

You should be able to see those branches with git branch -r (in this case the branch demo).

If you check it out you can work in it and svn dcommit to it.

I'm not sure if changing the svn-remote has messed up your repository or not, but I in your place I would assume that it did and would start over with your original clone command.

like image 67
Zsolt Rizsányi Avatar answered Dec 04 '22 06:12

Zsolt Rizsányi