threads / discuss / 8435

git-svn and googlecode.com?

Subject: git-svn and googlecode.com?

## tl;dr

3 messages between Jun 5, 2007 and Jun 5, 2007.

replies: 2people: 2as markdown or json

Rogan Dawes· Jun 5, 2007, 08:11 UTC · lore
Hi,

Thanks to Martin, I got git svnimport working on the Spring Rich Client Sourceforge repository. The published SVN checkout command line was:

svn co https://spring-rich-c.svn.sourceforge.net/svnroot/spring-rich-c \
  spring-rich-c
This translated into a git svnimport invocation of:
git-svnimport -i -v -o origin -T trunk/spring-richclient -t tags \
  -b branches \
https://spring-rich-c.svn.sourceforge.net/svnroot/spring-rich-c/
which works very well.
 From this I assume that the usual translation from Sourceforge 
published command lines works something like:
git svnimport -i -v -o origin -T trunk/<first path component> -t tags \
  -b branches <URL>
Using a similar approach for a repo at code.google.com, I tried:
(Original) svn checkout http://webgoat.googlecode.com/svn/trunk/ webgoat
(Funny, the initial path component had a space in it?!)
0 $ git-svn clone -T "trunk/ webgoat" 
https://webgoat.googlecode.com/svn/trunk/
Initialized empty Git repository in .git/
Using higher level of URL: https://webgoat.googlecode.com/svn/trunk => 
https://webgoat.googlecode.com/svn
W: Ignoring error from SVN, path probably does not exist: (175002): RA 
layer request failed: REPORT request failed on '/svn/!svn/bc/100': 
REPORT of '/svn/!svn/bc/100': 200 OK (https://webgoat.googlecode.com)
Path 'trunk/trunk/ webgoat' was probably deleted:
RA layer request failed: REPORT request failed on '/svn/!svn/bc/126': 
REPORT of '/svn/!svn/bc/126': 200 OK (https://webgoat.googlecode.com)
Will attempt to follow revisions r101 .. r126 committed before the deletion
0 $

This didn't actually do anything other than creating the .git directory structure, and creating one svn related file, even though it exited with a zero status (the prompt above includes the exit status of the previous command), and gave no diagnostics or error messages (other than "Using higher level . . . ")

1 $ find .git .git .git/branches .git/config .git/description .git/HEAD .git/hooks .git/hooks/applypatch-msg .git/hooks/commit-msg .git/hooks/post-commit .git/hooks/post-receive .git/hooks/post-update .git/hooks/pre-applypatch .git/hooks/pre-commit .git/hooks/pre-rebase .git/hooks/update .git/info .git/info/exclude .git/objects .git/objects/info .git/objects/pack .git/refs .git/refs/heads .git/refs/tags .git/remotes .git/svn .git/svn/.metadata .git/svn/trunk .git/svn/trunk/.rev_db.4033779f-a91e-0410-96ef-6bf7bf53c507

However, the following command line does seem to work:
git-svn clone -T "trunk/ webgoat" https://webgoat.googlecode.com/svn/

Note that I manually removed the "trunk" component from the URL. This suggests that there is something missing in the automatic "Using higher level" detection code.

Hope this helps someone diagnose this bug, as well as use git for accessing GoogleCode projects in the future.

Rogan
Andy Parkins· Jun 5, 2007, 09:05 UTC · re: Rogan Dawes · lore

Re: git-svn and googlecode.com?

On Tuesday 2007 June 05, Rogan Dawes wrote:
> (Original) svn checkout http://webgoat.googlecode.com/svn/trunk/ webgoat
>
> (Funny, the initial path component had a space in it?!)
I suspect that that is not the case.  The form of svn checkout is:
 svn checkout <url> <directory>

So your command is saying check out http://webgoat.googlecode.com/svn/trunk/ to the local directory "webgoat". That is to say - it doesn't have a space in it and in fact is nothing to do with the URL at all.

Show 9 quoted lines
> 0 $ git-svn clone -T "trunk/ webgoat"
> https://webgoat.googlecode.com/svn/trunk/
> Initialized empty Git repository in .git/
> Using higher level of URL: https://webgoat.googlecode.com/svn/trunk =>
> https://webgoat.googlecode.com/svn
> W: Ignoring error from SVN, path probably does not exist: (175002): RA
> layer request failed: REPORT request failed on '/svn/!svn/bc/100':
> REPORT of '/svn/!svn/bc/100': 200 OK (https://webgoat.googlecode.com)
> Path 'trunk/trunk/ webgoat' was probably deleted:
... which explains this error because there is no path "trunk/ webgoat".
> However, the following command line does seem to work:
>
> git-svn clone -T "trunk/ webgoat" https://webgoat.googlecode.com/svn/

Oh dear; I'm surprised it worked as well as it did. I just ran this command, which seemed to work well:

 $ git-svn clone -T trunk http://webgoat.googlecode.com/svn/ webgoat-local

This clones webgoat.googlecode.com/svn to the local directory webgoat-local; you can change "webgoat-local" to anything you want, it's just naming the directory on your own computer.

If you're the maintainer then perhaps you will want to change "http" to "https" as well.

> Note that I manually removed the "trunk" component from the URL. This
> suggests that there is something missing in the automatic "Using higher
> level" detection code.

I think there is no bug; it's simply a misunderstanding. git-svn working wonderfully for me.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Rogan Dawes· Jun 5, 2007, 10:11 UTC · re: Andy Parkins · lore

Re: git-svn and googlecode.com?

Andy Parkins wrote:
Show 14 quoted lines
> On Tuesday 2007 June 05, Rogan Dawes wrote:
> 
>> (Original) svn checkout http://webgoat.googlecode.com/svn/trunk/ webgoat
>>
>> (Funny, the initial path component had a space in it?!)
> 
> I suspect that that is not the case.  The form of svn checkout is:
> 
>  svn checkout <url> <directory>
> 
> So your command is saying check out http://webgoat.googlecode.com/svn/trunk/ 
> to the local directory "webgoat".  That is to say - it doesn't have a space 
> in it and in fact is nothing to do with the URL at all.
> 

I guess I didn't explain it very well. The checked out project had a directory with a leading space in it:

0 $ ls -alp total 0 drwxr-xr-x+ 3 rdawes Domain Users 0 Jun 4 14:20 webgoat/ drwxr-xr-x+ 4 rdawes Domain Users 0 Jun 4 14:20 ./ drwx------+ 28 rdawes ???????? 0 Jun 5 09:43 ../ drwxr-xr-x+ 10 rdawes Domain Users 0 Jun 4 14:20 .git/

Note the leading space before webgoat/?
i.e. the initial path component actually does have a space in it.
Show 11 quoted lines
>> 0 $ git-svn clone -T "trunk/ webgoat"
>> https://webgoat.googlecode.com/svn/trunk/
>> Initialized empty Git repository in .git/
>> Using higher level of URL: https://webgoat.googlecode.com/svn/trunk =>
>> https://webgoat.googlecode.com/svn
>> W: Ignoring error from SVN, path probably does not exist: (175002): RA
>> layer request failed: REPORT request failed on '/svn/!svn/bc/100':
>> REPORT of '/svn/!svn/bc/100': 200 OK (https://webgoat.googlecode.com)
>> Path 'trunk/trunk/ webgoat' was probably deleted:
> 
> ... which explains this error because there is no path "trunk/ webgoat".
Not so, see below.
Show 12 quoted lines
>> However, the following command line does seem to work:
>>
>> git-svn clone -T "trunk/ webgoat" https://webgoat.googlecode.com/svn/
> 
> Oh dear; I'm surprised it worked as well as it did.  I just ran this command, 
> which seemed to work well:
> 
>  $ git-svn clone -T trunk http://webgoat.googlecode.com/svn/ webgoat-local
> 
> This clones webgoat.googlecode.com/svn to the local directory webgoat-local; 
> you can change "webgoat-local" to anything you want, it's just naming the 
> directory on your own computer.

Sure. But then you cd into webgoat-local/, do an "ls -l", and you'll see exactly the same thing I showed above.

I'm still running your command above, but I'm seeing
W: -empty_dir: trunk/ webgoat/main/project/JavaSource/org
Note the space       ^
Show 9 quoted lines
> If you're the maintainer then perhaps you will want to change "http" 
> to "https" as well.
> 
>> Note that I manually removed the "trunk" component from the URL. This
>> suggests that there is something missing in the automatic "Using higher
>> level" detection code.
> 
> I think there is no bug; it's simply a misunderstanding.  git-svn working 
> wonderfully for me.

Um, I think that you did exactly what I said I did, namely removing the "trunk" component from the URL. Contrast:

Yours:
$ git-svn clone -T trunk http://webgoat.googlecode.com/svn/ \
     webgoat-local
Mine (original):
$ git-svn clone -T "trunk/ webgoat" \
     https://webgoat.googlecode.com/svn/trunk/
                                        ^^^^^
Mine (eventual):
$ git-svn clone -T "trunk/ webgoat" https://webgoat.googlecode.com/svn/

I'm sure there WAS a misunderstanding. It was me not understanding how to translate an SVN command line to a proper git command line, accounting for trunks, etc. That was one of the reasons I made the post, to clear it up, and to make sure that anyone searching for hints on how to use git to clone google code projects will find something, since I didn't.

So, it seems that the rule for googlecode is something like:
If the published command line is:
  svn checkout https://<project>.googlecode.com/svn/trunk/ <project>
You can clone this project using git-svn with the following command:
  git-svn clone -T trunk https://<project>.googlecode.com/svn/ <localdir>

If this results in too many levels of directories in the checked out project (e.g. "/workspace/webgoat/ webgoat/"), take the extra directory component and add it to the -T parameter (e.g. "-T 'trunk/ webgoat'")

Hopefully this helps the next person.
Thanks for your response.
Rogan

← back to recent threads