Exporting from fossil to git

2.2k views Asked by At

I've been trying to export my fossil repo into git using the instructions found here. I've seen this question here but it doesn't have an answer to my question.

I followed all the directions on https://www.fossil-scm.org/xfer/doc/tip/www/inout.wiki but I can't seem to get it to work.

I did the following:

git init new-repo
cd new-repo
fossil export --git ../repo.fossil | git fast-import

I get the statistics:

git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects:      10000
Total objects:         8831 (         8 duplicates                  )
      blobs  :         5578 (         0 duplicates       3374 deltas of       5224 attempts)
      trees  :         2509 (         8 duplicates       1419 deltas of       2378 attempts)
      commits:          744 (         0 duplicates          0 deltas of          0 attempts)
      tags   :            0 (         0 duplicates          0 deltas of          0 attempts)
Total branches:           1 (         1 loads     )
      marks:        1048576 (      6322 unique    )
      atoms:           4253
Memory total:          2704 KiB
       pools:          2235 KiB
     objects:           468 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit      = 8589934592
pack_report: pack_used_ctr            =       2936
pack_report: pack_mmap_calls          =        744
pack_report: pack_open_windows        =          1 /          1
pack_report: pack_mapped              =  207355128 /  207355128
---------------------------------------------------------------------

I don't see anything wrong, but I don't have a working repo. Am I missing a step? I didn't find any more info in the fossil documentation. Thanks in advance.

Edit: As an answer to the question below, I tried it with the -R and without the -R for the export command.

3

There are 3 answers

4
Anatoly Ruchka On

Usage: fossil export --git ?OPTIONS? ?REPOSITORY?

Write an export of all check-ins to standard output. The export is written in the git-fast-export file format assuming the --git option is provided. The git-fast-export format is currently the only VCS interchange format supported, though other formats may be added in the future.

Run this command within a checkout. Or use the -R or --repository option to specify a Fossil repository to be exported.

Only check-ins are exported using --git. Git does not support tickets or wiki or events or attachments, so none of those are exported.

If the "--import-marks FILE" option is used, it contains a list of rids to skip.

If the "--export-marks FILE" option is used, the rid of all commits and blobs written on exit for use with "--import-marks" on the next run.

Options: --export-marks FILE export rids of exported data to FILE --import-marks FILE read rids of data to ignore from FILE --repository|-R REPOSITORY export the given REPOSITORY

2
Yohanna On

First off, if it did work successfully, it will get imported into trunk branch, while git default branch is master so try the git checkout trunk as @Colin D Bennett said or git branch and see if it lists any branches in the repo.

If it didn't work or if git branch doesn't list any branches then the fossil export didn't work.

Now, I had the same problem before with exporting a fossil repo but with a different error:

Unable to open database file” when trying to export a fossil repo to git

The way I solved it is:

  1. git init git-repo
  2. cd fossil-repo
  3. fossil export --git > git.txt
  4. Move git.txt to git-repo
  5. type/cat git.txt | git fast-import
  6. git checkout trunk
  7. Voilà
0
Colin D Bennett On

You will need to check out the trunk branch of the new Git repository. By default, the git init command creates and checks out an empty branch called master. But Fossil uses trunk as its main branch.

So invoke git checkout trunk after the git fast-import and you'll be able to see all the files in the working directory.