View mode: basic / threaded / horizontal-split · Log in · Help
January 13, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
On 2012-01-13 12:12:09 +0000, Jacob Carlborg <doob@me.com> said:

> On 2012-01-13 10:04, Nick Sabalausky wrote:
>> "Jacob Carlborg"<doob@me.com>  wrote in message
>> news:jeont0$1bkp$1@digitalmars.com...
>>> 
>>> If --preserve-empty-dir isn't working, can't you add these directories
>>> after you've cloned the repository?
>>> 
>> 
>> I suppose it might be possible since git seems to be big on allowing history
>> rewrites, but I know next-to-nothing about how to actually do it :/
> 
> I see no reason to rewrite the history. Just clone the svn repository, 
> add the missing directories, add a .gitignore file to each of the 
> directories so git will keep them and then make a new commit.

But if you do that you won't have .gitignore files in all the SVN 
revisions you fetched, so older revisions will be broken.

What can be done is add the .gitignore files to all the revisions, like this:

	git filter-branch -f --tree-filter 'mkdir -p directory; touch 
directory/.gitignore' -- --all

Of course this will add the directory to all commits in all the 
branches of the repository, whether or not the directory was present in 
the SVN repository.


-- 
Michel Fortin
michel.fortin@michelf.com
http://michelf.com/
January 13, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
On 2012-01-13 14:35, Michel Fortin wrote:
> On 2012-01-13 12:12:09 +0000, Jacob Carlborg <doob@me.com> said:
>
>> On 2012-01-13 10:04, Nick Sabalausky wrote:
>>> "Jacob Carlborg"<doob@me.com> wrote in message
>>> news:jeont0$1bkp$1@digitalmars.com...
>>>>
>>>> If --preserve-empty-dir isn't working, can't you add these directories
>>>> after you've cloned the repository?
>>>>
>>>
>>> I suppose it might be possible since git seems to be big on allowing
>>> history
>>> rewrites, but I know next-to-nothing about how to actually do it :/
>>
>> I see no reason to rewrite the history. Just clone the svn repository,
>> add the missing directories, add a .gitignore file to each of the
>> directories so git will keep them and then make a new commit.
>
> But if you do that you won't have .gitignore files in all the SVN
> revisions you fetched, so older revisions will be broken.

True, didn't think of that.

> What can be done is add the .gitignore files to all the revisions, like
> this:
>
> git filter-branch -f --tree-filter 'mkdir -p directory; touch
> directory/.gitignore' -- --all
>
> Of course this will add the directory to all commits in all the branches
> of the repository, whether or not the directory was present in the SVN
> repository.

There's always a problem :)

-- 
/Jacob Carlborg
January 13, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
On 2012-01-13 03:32:25 +0000, "Nick Sabalausky" <a@a.a> said:

> $ git svn clone
> http://svn.dsource.org/projects/goldie --prefix=svn/ 
> --preserve-empty-dirs --authors-file=goldie-authors.txt
> --trunk=trunk --tags=tags Goldie
> ...the first few revisions (out of 557 total) here...
> r85 = 60d792abf9957f41f70d7ae399fee7ecda0b66f1 (refs/remotes/svn/trunk)
>         M       README.txt
> Failed to strip path 'bin/lang/.gitignore' ((?-xism:^trunk(/|$)))

You can fix yourself the git-svn script if you want:
<https://github.com/git/git/blob/master/git-svn.perl>

To me it seems like the git_path sub is called on an already stripped 
path. It would probably just work if you just removed the 'die' command 
on line 4583 of git-svn, even though that's a dirty fix. (Line number 
taken from github's master, you might be using a different version.)



-- 
Michel Fortin
michel.fortin@michelf.com
http://michelf.com/
January 13, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
Nick, I had similar issues, and I solved them by following a 
recipe from this article (written by a GitHub developer): 
http://www.jonmaddox.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/

I still believe Subversion is a very good VCS.
January 13, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
"Jacob Carlborg" <doob@me.com> wrote in message 
news:jep72q$2dvs$1@digitalmars.com...
>
> I see no reason to rewrite the history. Just clone the svn repository, add 
> the missing directories, add a .gitignore file to each of the directories 
> so git will keep them and then make a new commit.
>

Yea, like Michel said, that leaves the old revisions broken.

>
> Yeah, it's just a good page describing how to use git for a svn 
> repository.
>

It is, thanks.

>>
>> Does it still work if you give it --preserve-empty-dirs? (and yea, it 
>> seems
>> to work for me too as long as I omit that switch and allow it to throw 
>> away
>> my dirs at its discretion...)
>
> It seems I don't have that option.
>

I'm told it was added in Git v1.7.7. I had to compile a fresh git from 
source (although that might just be because I spent the last two years 
*completely* misunderstanding "apt-get upgrade"...and I think I have 
legitimate excuses for misunderstanding it, but that's a whole other 
topic...I plan to write a mini article-rant on it...)
January 13, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
"Michel Fortin" <michel.fortin@michelf.com> wrote in message 
news:jepbuq$2m7c$1@digitalmars.com...
> On 2012-01-13 12:12:09 +0000, Jacob Carlborg <doob@me.com> said:
>
>> On 2012-01-13 10:04, Nick Sabalausky wrote:
>>> "Jacob Carlborg"<doob@me.com>  wrote in message
>>> news:jeont0$1bkp$1@digitalmars.com...
>>>>
>>>> If --preserve-empty-dir isn't working, can't you add these directories
>>>> after you've cloned the repository?
>>>>
>>>
>>> I suppose it might be possible since git seems to be big on allowing 
>>> history
>>> rewrites, but I know next-to-nothing about how to actually do it :/
>>
>> I see no reason to rewrite the history. Just clone the svn repository, 
>> add the missing directories, add a .gitignore file to each of the 
>> directories so git will keep them and then make a new commit.
>
> But if you do that you won't have .gitignore files in all the SVN 
> revisions you fetched, so older revisions will be broken.
>
> What can be done is add the .gitignore files to all the revisions, like 
> this:
>
> git filter-branch -f --tree-filter 'mkdir -p directory; touch 
> directory/.gitignore' -- --all
>
> Of course this will add the directory to all commits in all the branches 
> of the repository, whether or not the directory was present in the SVN 
> repository.
>

Ahh, now I like that! It does, of course, mean that old revisions will be 
cluttered with unnesessary hidden files, and I'll need a commit to get rid 
of them going forward, but that's a *lot* better than the other way around 
(leaving them missing in the history and then adding them after the fact). 
"Works for me." I'll try it...
January 13, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
"Dejan Lekic" <dejan.lekic@gmail.com> wrote in message 
news:nlcegzzpmmfrgaljgzkh@dfeed.kimsufi.thecybershadow.net...
> Nick, I had similar issues, and I solved them by following a recipe from 
> this article (written by a GitHub developer): 
> http://www.jonmaddox.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/
>
> I still believe Subversion is a very good VCS.

Yes. You know, I've been wanting to do a little write-up of "Why I'm 
completely sold on DVCSes, but I was happier before them" :) And I still get 
annoyed when Torvalds rants and whines about SVN (has Linus *never* had to 
use Visual SourceSafe?) I also like that SVN seems to genuinely care about 
binary data/asset files (hugely important for things like games).

Admittedly, there was one big problem I did have with subversion: Every time 
I needed to move or rename a directory tree, subversion completely choked on 
it, and it was a PITA to fix the working copy. It's *extremely* brittle with 
that kind of change, you have to do it *exactly* right. Eventually I got 
into the habit of breaking the whole operation into carefully-chosen 
multiple committs, which seemed to help, but always felt "dirty", and I 
always dreaded doing it.
January 14, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
"Michel Fortin" <michel.fortin@michelf.com> wrote in message 
news:jeph56$bl$1@digitalmars.com...
> On 2012-01-13 03:32:25 +0000, "Nick Sabalausky" <a@a.a> said:
>
>> $ git svn clone
>> http://svn.dsource.org/projects/goldie --prefix=svn/ --preserve-empty-dirs - 
>> -authors-file=goldie-authors.txt
>> --trunk=trunk --tags=tags Goldie
>> ...the first few revisions (out of 557 total) here...
>> r85 = 60d792abf9957f41f70d7ae399fee7ecda0b66f1 (refs/remotes/svn/trunk)
>>         M       README.txt
>> Failed to strip path 'bin/lang/.gitignore' ((?-xism:^trunk(/|$)))
>
> You can fix yourself the git-svn script if you want:
> <https://github.com/git/git/blob/master/git-svn.perl>
>
> To me it seems like the git_path sub is called on an already stripped 
> path. It would probably just work if you just removed the 'die' command on 
> line 4583 of git-svn, even though that's a dirty fix. (Line number taken 
> from github's master, you might be using a different version.)
>

http://www.semitwist.com/download/av/sumomo-correct-confetti.avi

I went to that line in the git sources, changed "die" to "print", "make && 
sudo make install", and it works!

It doesn't, however, delete directories once they actually *are* deleted in 
the SVN repo, which is rather sloppy, but I can at least live with that.
January 14, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
"Nick Sabalausky" <a@a.a> wrote in message 
news:jeq72b$19me$1@digitalmars.com...
>
> (although that might just be because I spent the last two years 
> *completely* misunderstanding "apt-get upgrade"...and I think I have 
> legitimate excuses for misunderstanding it, but that's a whole other 
> topic...I plan to write a mini article-rant on it...)
>

https://www.semitwist.com/articles/article/view/doesn-t-anyone-understand-proper-usability-design
February 05, 2012
Re: [OT] Anyone w/ svn->git experience and advice?
Now that I've gotten it worked out, I've put up an article with my complete 
notes on the whole process in case anyone's interested or needs help doing 
the same thing:

https://www.semitwist.com/articles/article/view/the-better-svn-git-guide
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home