D
D
Denis Titusov2014-01-21 23:56:28
git
Denis Titusov, 2014-01-21 23:56:28

How to convert bazaar repository to git?

There is a bzr repository with about 300 commits. In this case, only one single brunch.
It is necessary to convert this repository to git for the reason that git turned out to be more convenient for me, and there are much more sites for it where you can put the code.
I tried this instruction , as a result I got an empty git repository.
When I tried to do as it is written in this instruction , I received the following error:

[email protected] ~/implement # bzr fast-export --plain `pwd` | git fast-import                                                         
02:51:37 Calculating the revisions to include ...
02:51:37 Starting export of 247 revisions ...
bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\u011f' in position 79: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 1121, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 673, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 697, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/fastimport/cmds.py", line 694, in run
    return exporter.run()
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/fastimport/exporter.py", line 238, in run
    self.emit_commit(revid, self.ref)
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/fastimport/exporter.py", line 356, in emit_commit
    self.print_cmd(self._get_commit_command(ref, mark, revobj, file_cmds))
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/fastimport/exporter.py", line 285, in print_cmd
    self.outf.write("%r\n" % cmd)
  File "/usr/lib/python2.7/dist-packages/fastimport/commands.py", line 140, in __repr__
    return self.to_string(include_file_contents=True)
  File "/usr/lib/python2.7/dist-packages/fastimport/commands.py", line 188, in to_string
    for c in self.iter_files()])
UnicodeEncodeError: 'ascii' codec can't encode character u'\u011f' in position 79: ordinal not in range(128)

You can report this problem to Bazaar's developers by running
    apport-bug /var/crash/bzr.0.2014-01-21T20:51.crash
if a bug-reporting window does not automatically appear.
git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects:       5000
Total objects:            0 (         0 duplicates                  )
      blobs  :            0 (         0 duplicates          0 deltas of          0 attempts)
      trees  :            0 (         0 duplicates          0 deltas of          0 attempts)
      commits:            0 (         0 duplicates          0 deltas of          0 attempts)
      tags   :            0 (         0 duplicates          0 deltas of          0 attempts)
Total branches:           0 (         0 loads     )
      marks:           1024 (         0 unique    )
      atoms:              0
Memory total:          2282 KiB
       pools:          2048 KiB
     objects:           234 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit      = 8589934592
pack_report: pack_used_ctr            =          0
pack_report: pack_mmap_calls          =          0
pack_report: pack_open_windows        =          0 /          0
pack_report: pack_mapped              =          0 /          0
---------------------------------------------------------------------

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DancingOnWater, 2014-01-22
@denis-titusov

Have you looked here ?

N
Nazar Mokrinsky, 2014-01-22
@nazarpc

I don’t have a ready-made instruction, I don’t use bazaar, but according to the logic of things, a script is written that:
- reads the list of commits
- cyclically
* does a checkout (or whatever it is called in bazaar) of each commit
* makes a commit in git
Thus, you will succeed similar git repository.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question