threads / discuss / 8732

git-svn error "Unable to extract revision information from commit ...~1"

Subject: git-svn error "Unable to extract revision information from commit ...~1"

## tl;dr

5 messages between Jun 26, 2007 and Jun 27, 2007.

replies: 4people: 3as markdown or json

Victor Bogado da Silva Lins· Jun 26, 2007, 19:09 UTC · lore

First of all, before I state the problems I am running into, I must say that I loved git. It is easy to setup, since there is no need to initialize a server or repository, powerful, because one can branch and merge as needed something that was harder in others. And on top of everything it is very easy to follow up the history with gitk. :-)

But not everything are flowers in my git-life. I have to use svn to commit upstream, in fact there are two different upstream svn servers. I tryied to maintain both coordinates using two git-svn repositories. But there are ocasions that the git-svn repository gets into a state that dcommit simply does not work anymore. :-(

The problem seem to be that when I merge the head with another branch git-svn does not know where to follow to meet the "svn trunk". So what happens it that I have a head that was merged from a side track development (usually rooted on the other svn server) and then it goes to the wrong side.

for instance : 
o master (merge commit) 17696dc402da59f8eba0dcd60f15a66859cb0c2a
|\
| o remotes/trunk svn head c0691ffaa3a41c6b5c13aec5b06b64f6321efd35
| |
o | mine local modifications f1494e9bb4c237253587c1ffdc150394c6813100
| | 
...
...

When I try to use dcommit the command fails to find the coorect path to make and send the diffs. I saw that svn-git user uses git-rev-list to make this path, but look at the list this command gives me :

17696dc402da59f8eba0dcd60f15a66859cb0c2a f1494e9bb4c237253587c1ffdc150394c6813100 c0691ffaa3a41c6b5c13aec5b06b64f6321efd35

the problem is that the last element is not a git-svn commit and the tool simply whants him to be son of a git-svn commit, this is the commit that goes "f1494e9bb4c237253587c1ffdc150394c6813100", an it is not on the last position as expected.

Got searchs for metadata in the wrong place and "boom" break... I don't know how to rever into a sane state, nor how can I avoid to get into this situatiom, since I havo not yet found a clear reason on how this came to be.

Steven Grimm· Jun 27, 2007, 01:50 UTC · re: Victor Bogado da Silva Lins · lore

Re: git-svn error "Unable to extract revision information from commit ...~1"

Victor Bogado da Silva Lins wrote:
> The problem seem to be that when I merge the head with another branch
> git-svn does not know where to follow to meet the "svn trunk". 

The current release of git-svn doesn't support committing merges. It has no clue how to walk nonlinear history, as you point out. The current practice is to do "git merge --squash" when merging into the git-svn branch that you want to use as the basis for your svn commit. The --squash option will make git merge the contents of the other branch(es) but record the resulting tree as a regular commit, not as a merge.

There is a work-in-progress patch which might help you if you need to preserve merge ancestry on the git side. Search the mailing list archives for "[PATCH] git-svn: allow dcommit to retain local merge information" if you want to try it (but be aware that it is just an initial implementation and may have bugs; it was posted so people could try it out and report back any problems to the author.)

-Steve
Junio C Hamano· Jun 27, 2007, 02:20 UTC · re: Steven Grimm · lore

Re: git-svn error "Unable to extract revision information from commit ...~1"

Steven Grimm <koreth@midwinter.com> writes:
Show 18 quoted lines
> Victor Bogado da Silva Lins wrote:
>> The problem seem to be that when I merge the head with another branch
>> git-svn does not know where to follow to meet the "svn trunk".
>
> The current release of git-svn doesn't support committing merges. It
> has no clue how to walk nonlinear history, as you point out. The
> current practice is to do "git merge --squash" when merging into the
> git-svn branch that you want to use as the basis for your svn
> commit. The --squash option will make git merge the contents of the
> other branch(es) but record the resulting tree as a regular commit,
> not as a merge.
>
> There is a work-in-progress patch which might help you if you need to
> preserve merge ancestry on the git side. Search the mailing list
> archives for "[PATCH] git-svn: allow dcommit to retain local merge
> information" if you want to try it (but be aware that it is just an
> initial implementation and may have bugs; it was posted so people
> could try it out and report back any problems to the author.)
... which has been cooking in 'next' for the past two weeks.
Steven Grimm· Jun 27, 2007, 16:57 UTC · lore

Re: git-svn error "Unable to extract revision information from commit ...~1"

Victor Bogado da Silva Lins wrote:
> I will try that, but on the other hand is it possible to commit the 
> diff between my head and the svn head with a new message? This would 
> be good enough for me.

Yes, that's pretty easy; you just have to do a squash merge to eliminate the nonlinear history. Assuming the svn head is called "trunk" and your head is called "myhead":

# start with the svn head git checkout -b trunk tempbranch # bring in all the changes from your branch git merge --squash myhead # commit with whatever message you want git commit # and ship it up to svn land git svn dcommit

-Steve
Steven Grimm· Jun 27, 2007, 20:25 UTC · lore

Re: git-svn error "Unable to extract revision information from commit ...~1"

Patrick Doyle wrote:
Show 7 quoted lines
> Wouldn't the svn head be called "git-svn"?
> Should the first checkout be written as:
>
> git checkout -b tempbranch git-svn
>
> (In other words, were the "trunk" and "tempbranch" arguments swapped
> in your example?)

Yes, sorry, I swapped the arguments. Should indeed be "git checkout -b (your new branch name) (svn head branch name)" rather than the other way around. My apologies for not proofreading my message.

However, the name of the svn head branch depends on the version of git-svn you're using, and how you cloned the svn repository. If you used the -T/--trunk option, then the svn head branch will indeed be called "trunk" (and you might also have other branches corresponding to whatever branches you're tracking in the svn repository.) If you're not using that option, then your svn tracking branch will be called "git-svn" or "origin" depending on your git-svn version.

> Finally, what is the purpose of creating a new branch as part of that 
> command?

You never ever want to work directly on the git-svn tracking branch. It is considered a remote branch and while it is technically possible to check it out and commit to it, you will almost certainly confuse git-svn if you do.

Also, creating a new branch means you still have your original nonlinear history easily accessible if you need it (just check out your old branch.) You can certainly still get at the old history without creating a new branch, but it's more awkward.

-Steve

← back to recent threads