threads / discuss / 9612

git-svnimport: what to do after -i?

Subject: git-svnimport: what to do after -i?

## tl;dr

8 messages between Aug 22, 2007 and Aug 24, 2007.

replies: 7people: 3as markdown or json

Jing Xue· Aug 22, 2007, 15:33 UTC · lore

I am new to git. Last night I used "git svnimport -i" to import a svn project. It finished successfully. The only problem now is I can't seem to be able to checkout a working copy. In other words, I have a 'projectFoo' directory, with only .git in it, but not any actual working files. "git-branch" shows two branches, master and origin. "git-checkout master" returns successfully, but does nothing.

I guess that's because I used -i without fully understanding what it implies. Is there any way to checkout a working directory?

Thanks in advance for any ideas.
-- 
Jing Xue
Steven Walter· Aug 22, 2007, 16:58 UTC · re: Jing Xue · lore

Re: git-svnimport: what to do after -i?

On Wed, Aug 22, 2007 at 11:33:25AM -0400, Jing Xue wrote:
Show 14 quoted lines
> 
> I am new to git. Last night I used "git svnimport -i" to import a svn  
> project. It finished successfully. The only problem now is I can't  
> seem to be able to checkout a working copy. In other words, I have a  
> 'projectFoo' directory, with only .git in it, but not any actual  
> working files. "git-branch" shows two branches, master and origin.  
> "git-checkout master" returns successfully, but does nothing.
> 
> I guess that's because I used -i without fully understanding what it  
> implies. Is there any way to checkout a working directory?
> 
> Thanks in advance for any ideas.
> -- 
> Jing Xue

See if "git reset --hard master" doesn't check out the files for you. I seem to recall an issue where, after an import, no files were checked out. reset fixed it for me.

-- 
-Steven Walter <stevenrwalter@gmail.com>
"A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects."
   -Robert Heinlein
Jing Xue· Aug 22, 2007, 17:04 UTC · re: Steven Walter · lore

Re: git-svnimport: what to do after -i?

Quoting Steven Walter <stevenrwalter@gmail.com>:
>
> See if "git reset --hard master" doesn't check out the files for you.  I
> seem to recall an issue where, after an import, no files were checked
> out.  reset fixed it for me.
Nope...  Tried that and "git reset --hard HEAD". Both simply print:
HEAD is now at 7be0678... <the last commit message imported>.
Thanks.
-- 
Jing Xue
Jing Xue· Aug 23, 2007, 01:28 UTC · re: Jing Xue · lore

Re: git-svnimport: what to do after -i?

OK, got it working. It had more to do with the module/trunk path than the -i.

My svn projects are organized like:
projectFoo
    -trunk
    -tags
    -branches
So I initially used:
git svnimport -C projectFoo -r -A svn-authors -I .gitignore -T projectFoo svn://jabba trunk
which resulted in the empty working directory - with or without the -i.
What ended up working is this:
git svnimport -C projectFoo -r -A svn-authors -I .gitignore -T projectFoo -P trunk svn://jabba
Cheers.
-- 
Jing Xue
Julian Phillips· Aug 23, 2007, 07:29 UTC · re: Jing Xue · lore

Re: git-svnimport: what to do after -i?

On Wed, 22 Aug 2007, Jing Xue wrote:
Show 20 quoted lines
> OK, got it working. It had more to do with the module/trunk path than
> the -i.
>
> My svn projects are organized like:
> projectFoo
>    -trunk
>    -tags
>    -branches
>
> So I initially used:
>
> git svnimport -C projectFoo -r -A svn-authors -I .gitignore -T projectFoo svn://jabba trunk
>
> which resulted in the empty working directory - with or without the -i.
>
> What ended up working is this:
>
> git svnimport -C projectFoo -r -A svn-authors -I .gitignore -T projectFoo -P trunk svn://jabba
>
> Cheers.

I haven't used svnimport in a while (and never with subprojects), but you seem to be specifying that projectFoo is your trunk - which doesn't seem right.

I would have expected the command to be:
git svnimport -C projectFoo -r -A svn-authors -I .gitignore svn://jabba projectFoo
-- 
Julian

  ---
Everything you know is wrong!
Jing Xue· Aug 23, 2007, 13:00 UTC · re: Julian Phillips · lore

Re: git-svnimport: what to do after -i?

On Thu, Aug 23, 2007 at 08:29:54AM +0100, Julian Phillips wrote:
Show 9 quoted lines
> 
> I haven't used svnimport in a while (and never with subprojects), but you 
> seem to be specifying that projectFoo is your trunk - which doesn't seem 
> right.
> 
> I would have expected the command to be:
> 
> git svnimport -C projectFoo -r -A svn-authors -I .gitignore svn://jabba 
> projectFoo
Thanks for bringing it up. :)

My svn structure (see my last email) is somewhat reversed from what svnimport assumes, which seems to be more along the lines of:

repoRoot
  -trunk
    -projectFoo
    -projectBar
  -tags
    -projectFoo
    -projectBar
  -branches
    -projectFoo
    -projectBar

So in my case I had to kind of cheat svnimport into thinking 'projectFoo' is the name of the "trunk" directory, and 'trunk' is the actually project name. And I had to create 'dummytags' and 'dummybranches' at repoRoot level (following somebody else's tip found on this list).

Of course doing so has two problems:
1. I can only import one project at one time, but my plan is to have
separated git repo for each project going forward, so this works out
just fine.
2. I can't actually import any tags and branches because my real tags
and branches are under projectFoo/tags and projectFoo/branches. This is
somewhat a loss, but we can cope with it by having the svn repo around
as the history book.

But then if there is any better way to achieve this, I would certainly be interested and eager to learn. Thanks.

-- 
Jing Xue
Julian Phillips· Aug 24, 2007, 00:18 UTC · re: Jing Xue · lore

Re: git-svnimport: what to do after -i?

On Thu, 23 Aug 2007, Jing Xue wrote:
Show 32 quoted lines
> On Thu, Aug 23, 2007 at 08:29:54AM +0100, Julian Phillips wrote:
>>
>> I haven't used svnimport in a while (and never with subprojects), but you
>> seem to be specifying that projectFoo is your trunk - which doesn't seem
>> right.
>>
>> I would have expected the command to be:
>>
>> git svnimport -C projectFoo -r -A svn-authors -I .gitignore svn://jabba
>> projectFoo
>
> Thanks for bringing it up. :)
>
> My svn structure (see my last email) is somewhat reversed from what
> svnimport assumes, which seems to be more along the lines of:
>
> repoRoot
>  -trunk
>    -projectFoo
>    -projectBar
>  -tags
>    -projectFoo
>    -projectBar
>  -branches
>    -projectFoo
>    -projectBar
>
> So in my case I had to kind of cheat svnimport into thinking
> 'projectFoo' is the name of the "trunk" directory, and 'trunk' is the
> actually project name. And I had to create 'dummytags' and
> 'dummybranches' at repoRoot level (following somebody else's tip found
> on this list).

Ah, yes ... sorry. I've actually ended up using a homebrew script for parsing svn dump files and feeding git-fast-import for a number of reasons, so I'm a bit rusty with svnimport, and never looked at multiple projects in one repo anyway. (One of which was that svnimport wasn't creating a correct import actually - some files and directories were simply missing).

Show 13 quoted lines
> Of course doing so has two problems:
>
> 1. I can only import one project at one time, but my plan is to have
> separated git repo for each project going forward, so this works out
> just fine.
>
> 2. I can't actually import any tags and branches because my real tags
> and branches are under projectFoo/tags and projectFoo/branches. This is
> somewhat a loss, but we can cope with it by having the svn repo around
> as the history book.
>
> But then if there is any better way to achieve this, I would certainly
> be interested and eager to learn. Thanks.

I guess you've tried including projectFoo in the url? Other than that, perhaps git-svn may have better luck?

-- 
Julian

  ---
I'm not a real movie star -- I've still got the same wife I started out
with twenty-eight years ago.
 		-- Will Rogers
Jing Xue· Aug 24, 2007, 01:06 UTC · re: Julian Phillips · lore

Re: git-svnimport: what to do after -i?

On Fri, Aug 24, 2007 at 01:18:49AM +0100, Julian Phillips wrote:
Show 14 quoted lines
> On Thu, 23 Aug 2007, Jing Xue wrote:
> 
> >So in my case I had to kind of cheat svnimport into thinking
> >'projectFoo' is the name of the "trunk" directory, and 'trunk' is the
> >actually project name. And I had to create 'dummytags' and
> >'dummybranches' at repoRoot level (following somebody else's tip found
> >on this list).
> 
> Ah, yes ... sorry.  I've actually ended up using a homebrew script for 
> parsing svn dump files and feeding git-fast-import for a number of 
> reasons, so I'm a bit rusty with svnimport, and never looked at multiple 
> projects in one repo anyway.  (One of which was that svnimport wasn't 
> creating a correct import actually - some files and directories were 
> simply missing).

That's... not good to hear about. I should probably look at svn dump as well.

> I guess you've tried including projectFoo in the url?  Other than that, 
> perhaps git-svn may have better luck?

I tried that too but decided against it as it's relatively OK to lose some ancient history, but messing up ongoing development due to any possible issues in the git-svn layer would be quite different a story. (and from what you just mentioned, that's not entirely a paranoia 8-)

Thanks.
-- 
Jing

← back to recent threads