[OT] Anyone w/ svn->git experience and advice?

Russel Winder russel at russel.org.uk
Fri Jan 13 00:25:00 PST 2012


Nick,

On Thu, 2012-01-12 at 22:32 -0500, Nick Sabalausky wrote:
> I apologize for going so far offtopic with this. But I've taken this to the 
> git mailing list, and after working on it for days it's still not working 
> and I'm just about pulling my hair out. What makes it even more frustrating 
> is that when I attempted SVN->Hg and SVN->Bzr, those were even *more* 
> problematic (especially Bzr).

Far from off-topic given the purpose is to work with D-related
repositories I would say.

I am surprised you had problems with Mercurial and Bazaar, their support
for working with Subversion is very good.

The hgsubversion plugin for Mercurial is excellent and Augie Fackler and
the rest of the development folks are helpful and supportive.  A few
months ago we switched the SCons repository from Subversion to Mercurial
and apart from one thing -- which Augie fixed very quickly -- all the
problems turned out to be user error -- which they helped sort out well.

The Bazaar plugin is also excellent:  Jelmer Vernooij has done a great
job of ensuring that  that is the case.  All problems I have had with
anything to do with this either got fixed by Jelmer ages ago or turned
out to be errors in the Subversion repository.

Both these teams will tell you that Subversion is very good at leaving
inconsistencies in repositories that the user can never be aware of, but
which means that conversion to another system requires hacking.

Having said this it probably makes sense for D-related repositories to
be Git ones since D itself is in a Git repository? 

> I know DMD made the switch from SVN to Git at one point, so I'm hoping 
> someone here might be able to help out before I finally go nuts:
> 
> Summary:
> --------------
> 
> I'm trying to use "git svn clone --preserve-empty-dirs ..." (Git v1.7.8.3, 
> Linux) but after it gets through only a fraction of the revisions, it just 
> bails with some cryptic:

Git doesn't actually understand directories at all, it only deals with
files and paths.  As I understand it, they hack the above by putting
hidden files in place.  This really sucks.

> On one SVN repo:
> Failed to strip path 'bin/lang/.gitignore' ((?-xism:^trunk(/|$)))

This does indeed looks bizarrely odd.

> On the other SVN repo:
> Failed to strip path 'src/nonFatalAssertTest/.gitignore' 
> ((?-xism:^trunk(/|$)))

Ditto.

Are these to do with the empty directories?  If so I would just give up
and live with the fact that Git doesn't understand directories only
files.

> 
> The Full Picture:
> -------------------------
> 
> I want to convert these to Git:
> 
> http://svn.dsource.org/projects/semitwist
> http://svn.dsource.org/projects/goldie
> 
> Notes:
> 
> - Goldie has some tags.
> - Neither repo has branches.
> - Being SVN, I wasn't shy about including required empty dirs in the repo 
> (since every F&*#&$@ filesystem on the G*#$*%^$ planet handles them fine.) I 
> need to keep these.

Subversion is not a version control system, it is a versioned filestore
that can be used for version control.  Clearly it must understand
directories as well as files.  Mercurial and Bazaar also understand
directories as well as files -- Bazaar better than Mercurial overall --
Git doesn't.

> - For awhile I had been including compiled binaries in the repo. Don't ask 
> me why, I just did :) I need to remove these.

--ignore-paths ?

> - Obviously not interested in preserving the "downloads" directory (just a 
> DSource-ism anyway).

--ignore-paths?

> - Both repos are small enough that known-to-be-slow git-svn should still be 
> plenty fast enough for this task.

When doing conversions from Subversion, I always found it best to mirror
the Subversion repository locally and then do the conversions as
operations on local filestore. 

This also of course allows you to manually edit the Subversion
repository to remove all the crap and then  do the conversion.  No need
for --ignore-paths and all that technology.  Also you are in control of
removing the Subversion inconsistencies if there are any.

> I did get some help at the git mailing list:
> http://git.661346.n2.nabble.com/SVN-gt-Git-but-with-special-changes-td6840904.html
> 
> They showed me how to strip the binaries from the Git repo after it's 
> converted (although I haven't gotten that far yet). And I've found some 
> tutorials that help out with the author conversions, etc. The problem is 
> actually converting the dang repos, and doing it while preserving tags and 
> *all* directories (not just the ones that Git's decided are worthy of 
> existing). But like I said above, git-svn is just crapping out:
> 
> $ git svn clone 
> http://svn.dsource.org/projects/semitwist --prefix=svn/ --preserve-empty-dirs - 
> -authors-file=semitwistdtools-authors.txt  --trunk=trunk --tags=tags 
> SemiTwistDTools
> ...the first few revisions (out of 242 total) here...
> r46 = 61d45b1e70c129a5096bb35686f0d024786c1204 (refs/remotes/svn/trunk)
>         A       cmdTest.pnproj
> Failed to strip path 'src/nonFatalAssertTest/.gitignore' 
> ((?-xism:^trunk(/|$)))
> 
> $ 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(/|$)))
> 

I wonder if part of the problem is that you are not telling it the
details of the Subversion repository filestore structure.  I have never
found that the git-svn defaults work satisfactorily.  If the repository
has the usual trunk/branches/tags structure then give the -s option,
otherwise give the --trunk, --branches, and --tags options explicitly.

I hope this helps.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at russel.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120113/89d920ef/attachment.pgp>


More information about the Digitalmars-d mailing list