Git development
 help / color / mirror / Atom feed
From: Urs Thuermann <urs@isnogud.escape.de>
To: git@vger.kernel.org
Subject: Migration from CVS to Git looses merges
Date: 25 Jun 2017 09:12:52 +0200	[thread overview]
Message-ID: <ygfd19stua3.fsf@tehran.isnogud.escape.de> (raw)

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

             reply	other threads:[~2017-06-25  7:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-25  7:12 Urs Thuermann [this message]
2017-06-25  8:13 ` Migration from CVS to Git looses merges Andreas Schwab
2017-06-25  9:30   ` Urs Thuermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ygfd19stua3.fsf@tehran.isnogud.escape.de \
    --to=urs@isnogud.escape.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox