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

Migration from CVS to Git looses merges

From
Urs Thuermann <urs@isnogud.escape.de>
Date
Jun 25, 2017, 07:12 UTC
Message-ID
<ygfd19stua3.fsf@tehran.isnogud.escape.de>

I want to convert several old CVS repositories to Git. Some of these CVS repositories contain branches, which have later been merged to the main trunk. When I try to convert using cvs2git or git cvsimport the branches appear in the new git repository but they are not merged to the master branch.

Here is an example of how the branches in the CVS repository were created and merged:

    cd /tmp
    export CVSROOT=$PWD/CVS
    cvs init
    mkdir CVS/foo
    cvs co foo
    cd foo
    (date; seq 10; date) > bar
    cvs add bar
    cvs ci -m msg1                              # rev 1.1
    sleep 1
    printf "1c\n%s\n.\nwq\n" "`date`" | ed bar
    cvs ci -m msg2                              # rev 1.2
    sleep 1
    cvs tag -b a-branch
    sleep 1
    printf "1c\n%s\n.\nwq\n" "`date`" | ed bar
    cvs ci -m msg3                              # rev 1.3
    sleep 1
    cvs up -r a-branch
    printf "12c\n%s\n.\nwq\n" "`date`" | ed bar
    cvs ci -m msg-b1                            # rev 1.2.2.1
    sleep 1
    printf "12c\n%s\n.\nwq\n" "`date`" | ed bar
    cvs ci -m msg-b2                            # rev 1.2.2.2
    sleep 1
    cvs up -A
    cvs up -j a-branch
    cvs ci -m "Merge branch a-branch"           # rev 1.4
Now I have tried 2 ways to convert this to git:
1. mkdir g; cd g; git cvsimport -A <file> -m foo
2. mkdir g; cd g; git init;
   cvs2git --blobfile=foo.blob --dumpfile=foo.dump --username=urs ../CVS/foo
   cat foo.blob foo.dump | git fast-import

In both cases, the branch "a-branch" is in the git repository but is not merged with the master branch, i.e. rev 1.4 has only parent 1.3 but not 1.2.2.2. I also tried cvsimport with several regexes passed using -M to match "Merge branch a-branch", but still the same result.

How should the CVS repository be converted to git, so that the commit corresponding to rev 1.4 has two parents, 1.3 and 1.2.2.2?

urs
Next: Andreas Schwab
Message 1 of 3 in “Migration from CVS to Git looses merges”
  1. Urs ThuermannJun 25, 2017
  2. Andreas SchwabJun 25, 2017
  3. Urs ThuermannJun 25, 2017

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.