Re: Approaches to SVN to Git conversion
- From
Phil Hord <phil.hord@gmail.com>
- Date
- Mar 7, 2012, 22:33 UTC
- Message-ID
- <CABURp0pLnMdFVgQ2+S_rW-KEjUBjKbEbMepEdPUkRJD+JQ_Ehg@mail.gmail.com>
- In-Reply-To
- <4F5690FB.9060800@pileofstuff.org>
On Tue, Mar 6, 2012 at 5:34 PM, Andrew Sayers <andrew-git@pileofstuff.org> wrote:
Show 18 quoted lines
> This is quite close to the implementation I've got. The SVN exporter > runs in two stages: > > In the first stage, the script treats any non-blacklisted file as a > marker file, but only looks for trunk branches. It looks all through > the history, traces back through the copyfroms, and tries to find the > original directory associated with the file. Usually it decides that > the only branch without a copyfrom is /trunk. Searching just for trunks > with this weak heuristic makes it much easier to hand-verify the result. > > In the second stage, the script looks through the history again, tracing > the copies of known branches in a slightly less clever way than > described in my previous e-mail. There's no need for marker files this > time round, as we just assume any `svn cp /trunk > /directory/not/within/a/branch` is a new branch. In my experiments this > has been a pretty solid way of detecting branches without too much human > input - I might be missing something (or have mis-explained something), > but I'd be interested to hear examples of where this would go wrong.
I think what you're describing would work perfectly for my weird svn repo. I have branches named like this:
branches/developer/hordp/foo branches/developer/hordp/bar etc.
Since these were created with 'svn cp' originally, they would be properly considered branches by your algorithm, right? If so, sweet!
Show 23 quoted lines
> Having said that, here's a dodgy example I'd like to pre-emptively defend: > > svn add tronk > svn ci -m "Created trunk" # r1 > svn cp tronk trunk > svn ci -m "D'oh" # r2 > svn rm tronk > svn add trunk/markerFile.txt > svn ci -m "Double d'oh!" # r3 > > You could argue that the correct branch history description for the > above would be: > > In r3, create branch "trunk" > > In other words, ignore everything that happened before the marker file > was created. However, I would argue the following representation is > more correct: > > In r1, create branch "tronk" > In r2, create branch "trunk" from "tronk" r1 > In r3, delete branch "tronk" >
I prefer your interpretation. It doesn't look dodgy at all.
Phil