git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Approaches to SVN to Git conversion

From
Nathan Gray <n8gray@n8gray.org>
Date
Mar 7, 2012, 23:08 UTC
Message-ID
<CA+7g9JzETuynGMCRo1MLuNErFiFc3AmhGS6Hr+jO-hoV2j4JDg@mail.gmail.com>
In-Reply-To
<4F5690FB.9060800@pileofstuff.org>

On Tue, Mar 6, 2012 at 2:34 PM, Andrew Sayers <andrew-git@pileofstuff.org> wrote: [snip]

Show 27 quoted lines
> On 06/03/12 19:29, Nathan Gray wrote:
> <snip>
>>
>> The problem of specifying and detecting branches is a major problem in
>> my upcoming conversion.  We've got toplevel trunk/branches/tags
>> directories but underneath "branches" it's a free-for-all:
>>
>> /branches/codenameA/{projectA,projectB,projectC}
>> /branches/codenameB   (actually a branch of projectA)
>> /branches/developers/joe/frobnicator-experiment (also a branch of projectA)
>>
>> Clearly there's no simple regex that's going to capture this, so I'm
>> reduced to listing every branch of projectA, which is tedious and
>> error-prone.  However, what *would* work fabulously well for me is
>> "marker file" detection.  Every copy of projectA has a certain file at
>> it's root.  Let's call it "markerFile.txt".  What I'd really love is a
>> way to say:
>
> 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.

I'm not sure I understand. So if I have /trunk/projectA and /trunk/projectB then do I have to blacklist /trunk/projectB to extract only projectA's history? Assuming it's always lived there will your code detect /trunk/projectA as the "trunk?" Would it be possible to specify /trunk/projectA directly instead of blacklisting everything else?

Show 8 quoted lines
> 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.

That sounds pretty good, but it should probably also be transitive, i.e. `svn cp /any/known/branch/root /some/new/path` is also a new branch. Sometimes we'll spin off hotfix branches from release branches, for example.

I'll have to give your code a try and see how it works.

Cheers, -n8

-- 
http://n8gray.org
Previous: Phil HordNext: Andrew Sayers
Message 19 of 22 in “[RFC] "Remote helper for Subversion" project”
  1. David BarrMar 3, 2012
  2. David BarrMar 3, 2012
  3. Jonathan NiederMar 4, 2012
  4. David BarrMar 4, 2012
  5. Andrew SayersMar 4, 2012
  6. Approaches to SVN to Git conversion (was: Re: [RFC] "Remote helper for Subversion" project)Stephen Bash, Mar 5, 2012
  7. Andrew SayersMar 5, 2012
  8. Stephen BashMar 6, 2012
  9. Nathan GrayMar 6, 2012
  10. Stephen BashMar 6, 2012
  11. Sam VilainMar 6, 2012
  12. Andrew SayersMar 7, 2012
  13. Sam VilainMar 7, 2012
  14. Andrew SayersMar 8, 2012
  15. Andrew SayersMar 6, 2012
  16. Sam VilainMar 7, 2012
  17. Andrew SayersMar 7, 2012
  18. Phil HordMar 7, 2012
  19. Nathan GrayMar 7, 2012
  20. Andrew SayersMar 7, 2012
  21. Jonathan NiederMar 4, 2012
  22. Ramkumar RamachandraMar 27, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.