librelist archives

« back to archive

Migrate repository, bzr to git

Migrate repository, bzr to git

From:
Ron DuPlain
Date:
2010-02-09 @ 19:21
I was looking for a way to migrate a bzr repository to git -- I really
like git's in-place branching.  I tried tailor
(http://progetti.arstecnica.it/tailor), but it kept failing.  The
solution ended up being extremely easy: bzr fast-export `pwd` | git
fast-import.

To convert a bzr repository to git (cwd: bzr repo):
$ git init &&
   bzr fast-export `pwd` | git fast-import &&
   rm -r .bzr &&
   git reset HEAD

This will take your current working directory, build git history, and
destroy bzr history.  Do not run this on any important bzr branch, as
it will get eaten.

My bzr repo was pretty simple, but I suspect this will work on large
projects as well.

-Ron

Re: [cville] Migrate repository, bzr to git

From:
Daniel Lepage
Date:
2010-02-09 @ 19:41
Just out of curiosity, does the same thing run in reverse? Are 'fast-import'
and 'fast_export' part of some larger repository standard that both bzr and
git can speak?

-- 
Dan

On Feb 9, 2010 2:22 PM, "Ron DuPlain" <ron.duplain@gmail.com> wrote:

I was looking for a way to migrate a bzr repository to git -- I really
like git's in-place branching.  I tried tailor
(http://progetti.arstecnica.it/tailor), but it kept failing.  The
solution ended up being extremely easy: bzr fast-export `pwd` | git
fast-import.

To convert a bzr repository to git (cwd: bzr repo):
$ git init &&
  bzr fast-export `pwd` | git fast-import &&
  rm -r .bzr &&
  git reset HEAD

This will take your current working directory, build git history, and
destroy bzr history.  Do not run this on any important bzr branch, as
it will get eaten.

My bzr repo was pretty simple, but I suspect this will work on large
projects as well.

-Ron

Re: [cville] Migrate repository, bzr to git

From:
Ron DuPlain
Date:
2010-02-09 @ 20:12
Great question.  I wasn't able to do a conversion in-place, because
bzr sees the .git directory.  Here's what I did, in a fresh directory:

export GIT_DIR=path/to/repo-name/.git
mkdir repo-name
cd repo-name
bzr init
git fast-export --all | bzr fast-import -
bzr update

Done.

I'm not sure which version control systems implement
fast-export/fast-import, but git and bzr do.

$ apt-cache show bzr-fastimport
...

 Bazaar Fast Import is a plugin providing fast loading of revision control
 data into Bazaar.
 .
 It is designed to be used in combination with front-end programs that
 generate a command/data stream for it to process. Front-ends are available
 for a wide range of foreign VCS tools including Subversion, CVS, Git,
 Mercurial, Darcs and Perforce. New front-ends are easy to develop in whatever
 programming language you prefer, making Bazaar Fast Import useful for teams
 needing a custom migration solution.

-Ron

On Tue, Feb 9, 2010 at 2:41 PM, Daniel Lepage <dplepage@gmail.com> wrote:
> Just out of curiosity, does the same thing run in reverse? Are 'fast-import'
> and 'fast_export' part of some larger repository standard that both bzr and
> git can speak?
>
> --
> Dan
>
> On Feb 9, 2010 2:22 PM, "Ron DuPlain" <ron.duplain@gmail.com> wrote:
>
> I was looking for a way to migrate a bzr repository to git -- I really
> like git's in-place branching.  I tried tailor
> (http://progetti.arstecnica.it/tailor), but it kept failing.  The
> solution ended up being extremely easy: bzr fast-export `pwd` | git
> fast-import.
>
> To convert a bzr repository to git (cwd: bzr repo):
> $ git init &&
>   bzr fast-export `pwd` | git fast-import &&
>   rm -r .bzr &&
>   git reset HEAD
>
> This will take your current working directory, build git history, and
> destroy bzr history.  Do not run this on any important bzr branch, as
> it will get eaten.
>
> My bzr repo was pretty simple, but I suspect this will work on large
> projects as well.
>
> -Ron
>

Re: [cville] Migrate repository, bzr to git

From:
Kai Groner
Date:
2010-02-10 @ 06:48
There are some fast-export tools for hg/svn/git at
git://repo.or.cz/fast-export.git

I use the hg one, I haven't tried going in reverse yet.  The
git-fast-import(1) man page seems to describe the format/philosophy.


Kai

On Tue, Feb 9, 2010 at 3:12 PM, Ron DuPlain <ron.duplain@gmail.com> wrote:

> Great question.  I wasn't able to do a conversion in-place, because
> bzr sees the .git directory.  Here's what I did, in a fresh directory:
>
> export GIT_DIR=path/to/repo-name/.git
> mkdir repo-name
> cd repo-name
> bzr init
> git fast-export --all | bzr fast-import -
> bzr update
>
> Done.
>
> I'm not sure which version control systems implement
> fast-export/fast-import, but git and bzr do.
>
> $ apt-cache show bzr-fastimport
> ...
>
>  Bazaar Fast Import is a plugin providing fast loading of revision control
>  data into Bazaar.
>  .
>  It is designed to be used in combination with front-end programs that
>  generate a command/data stream for it to process. Front-ends are available
>  for a wide range of foreign VCS tools including Subversion, CVS, Git,
>  Mercurial, Darcs and Perforce. New front-ends are easy to develop in
> whatever
>  programming language you prefer, making Bazaar Fast Import useful for
> teams
>  needing a custom migration solution.
>
> -Ron
>
> On Tue, Feb 9, 2010 at 2:41 PM, Daniel Lepage <dplepage@gmail.com> wrote:
> > Just out of curiosity, does the same thing run in reverse? Are
> 'fast-import'
> > and 'fast_export' part of some larger repository standard that both bzr
> and
> > git can speak?
> >
> > --
> > Dan
> >
> > On Feb 9, 2010 2:22 PM, "Ron DuPlain" <ron.duplain@gmail.com> wrote:
> >
> > I was looking for a way to migrate a bzr repository to git -- I really
> > like git's in-place branching.  I tried tailor
> > (http://progetti.arstecnica.it/tailor), but it kept failing.  The
> > solution ended up being extremely easy: bzr fast-export `pwd` | git
> > fast-import.
> >
> > To convert a bzr repository to git (cwd: bzr repo):
> > $ git init &&
> >   bzr fast-export `pwd` | git fast-import &&
> >   rm -r .bzr &&
> >   git reset HEAD
> >
> > This will take your current working directory, build git history, and
> > destroy bzr history.  Do not run this on any important bzr branch, as
> > it will get eaten.
> >
> > My bzr repo was pretty simple, but I suspect this will work on large
> > projects as well.
> >
> > -Ron
> >
>