threads / discuss / 25309

cvs importing a forked project

Subject: cvs importing a forked project

## tl;dr

7 messages between Oct 1, 2010 and Oct 6, 2010.

replies: 6people: 3as markdown or json

Eric Frederich· Oct 1, 2010, 17:38 UTC · lore
Hello,

I have a project (several actually) where development was done in cvs for 10 years. Then, about 5 years ago, a copy of the latest was made and development continued in a new project. Development in the old project stopped for the most part.

Is there any way where I can combine these two projects in git? Basically, take the newer project's first commit and make its parent the the last commit of the older project. Development was pretty linear.

Thanks, ~Eric

Ævar Arnfjörð Bjarmason· Oct 1, 2010, 17:53 UTC · re: Eric Frederich · lore

Re: cvs importing a forked project

On Fri, Oct 1, 2010 at 17:38, Eric Frederich <eric.frederich@gmail.com> wrote:
Show 9 quoted lines
> I have a project (several actually) where development was done in cvs
> for 10 years.  Then, about 5 years ago, a copy of the latest was made
> and development continued in a new project.
> Development in the old project stopped for the most part.
>
> Is there any way where I can combine these two projects in git?
> Basically, take the newer project's first commit and make its parent
> the the last commit of the older project.
> Development was pretty linear.

Sure, you import them both into git with cvs2git (or something like that), then you fetch all the commits into a single git repository.

Then it becomes a problem of merging two git histories, something that's widely documented and well understood.

Brandon Casey· Oct 1, 2010, 17:57 UTC · re: Eric Frederich · lore

Re: cvs importing a forked project

On 10/01/2010 12:38 PM, Eric Frederich wrote:
Show 11 quoted lines
> Hello,
> 
> I have a project (several actually) where development was done in cvs
> for 10 years.  Then, about 5 years ago, a copy of the latest was made
> and development continued in a new project.
> Development in the old project stopped for the most part.
> 
> Is there any way where I can combine these two projects in git?
> Basically, take the newer project's first commit and make its parent
> the the last commit of the older project.
> Development was pretty linear.
You can do this very easily using grafts.
   https://git.wiki.kernel.org/index.php/GraftPoint

filter-branch can be used to rewrite the history and make the grafts permanent.

-Brandon
Eric Frederich· Oct 5, 2010, 18:38 UTC · re: Brandon Casey · lore

Re: cvs importing a forked project

Interesting. Looks easy to use except I can't figure out how to get the two projects imported to the same git project.

If I run the following...

$ git cvsimport -C myproject -d /some/vault projects/foo_old $ git cvsimport -C myproject -d /some/vault projects/foo_new

... then the projects look to be merged at some arbitrary point in time based on date. I'm not even sure if the entire history of foo_new is imported. This is just based off of what gitk is showing me but it seems to take the entire history of foo_old but when importing foo_new but it looks like only commits made after the last commit of foo_old are imported.

Obviously this isn't even using grafts since there is no grafts file. How do I get these two projects imported in their entirety into a single git repository so that I can create my own grafts file? Also, once I have my two projects imported into the same grafts file they should be completely independent right?... how do I switch between them then or even know what the SHA-1's are if they're not connected at all?

Thanks, ~Eric

On Fri, Oct 1, 2010 at 1:57 PM, Brandon Casey <brandon.casey.ctr@nrlssc.navy.mil> wrote:

Show 22 quoted lines
> On 10/01/2010 12:38 PM, Eric Frederich wrote:
>> Hello,
>>
>> I have a project (several actually) where development was done in cvs
>> for 10 years.  Then, about 5 years ago, a copy of the latest was made
>> and development continued in a new project.
>> Development in the old project stopped for the most part.
>>
>> Is there any way where I can combine these two projects in git?
>> Basically, take the newer project's first commit and make its parent
>> the the last commit of the older project.
>> Development was pretty linear.
>
> You can do this very easily using grafts.
>
>   https://git.wiki.kernel.org/index.php/GraftPoint
>
> filter-branch can be used to rewrite the history and make the grafts
> permanent.
>
> -Brandon
>
Ævar Arnfjörð Bjarmason· Oct 5, 2010, 19:20 UTC · re: Eric Frederich · lore

Re: cvs importing a forked project

On Tue, Oct 5, 2010 at 18:38, Eric Frederich <eric.frederich@gmail.com> wrote:
Show 7 quoted lines
> Interesting.  Looks easy to use except I can't figure out how to get
> the two projects imported to the same git project.
>
> If I run the following...
>
> $ git cvsimport -C myproject -d /some/vault projects/foo_old
> $ git cvsimport -C myproject -d /some/vault projects/foo_new

Either switch to a new parentless branch between the two (I don't know cvsimport), or import them in two distinct git repositories. Then when that's finished do:

    git init the-merge &&
    cd the-merge &&
    git remote add ~/cvs-repo-1 &&
    git remote add ~/cvs-repo-2 &&
    git remote update

And you'll have all those commits / branches / tags from both of them to work with.

Eric Frederich· Oct 6, 2010, 14:51 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: cvs importing a forked project

Thanks a bunch. That set of commands seemed to work except the "git remote add" commands needed a name. After doing that I saw both disconnected trees in gitk. I created my .git/info/grafts file and it looked good. I removed the two remotes afterwards and had to manually create a master branch.

I wanted to try to "switch to a new parentless branch" but don't know how. How can I create / switch to a new empty parentless branch?

On Tue, Oct 5, 2010 at 3:20 PM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 22 quoted lines
> On Tue, Oct 5, 2010 at 18:38, Eric Frederich <eric.frederich@gmail.com> wrote:
>> Interesting.  Looks easy to use except I can't figure out how to get
>> the two projects imported to the same git project.
>>
>> If I run the following...
>>
>> $ git cvsimport -C myproject -d /some/vault projects/foo_old
>> $ git cvsimport -C myproject -d /some/vault projects/foo_new
>
> Either switch to a new parentless branch between the two (I don't know
> cvsimport), or import them in two distinct git repositories. Then when
> that's finished do:
>
>    git init the-merge &&
>    cd the-merge &&
>    git remote add ~/cvs-repo-1 &&
>    git remote add ~/cvs-repo-2 &&
>    git remote update
>
> And you'll have all those commits / branches / tags from both of them
> to work with.
>
Ævar Arnfjörð Bjarmason· Oct 6, 2010, 16:34 UTC · re: Eric Frederich · lore

Re: cvs importing a forked project

On Wed, Oct 6, 2010 at 14:51, Eric Frederich <eric.frederich@gmail.com> wrote:
> I wanted to try to "switch to a new parentless branch" but don't know how.
> How can I create / switch to a new empty parentless branch?
    git checkout --orphan parentless-branch-name-here

← back to recent threads