frej / fast-export

A mercurial to git converter using git-fast-import
http://repo.or.cz/w/fast-export.git
808 stars 255 forks source link

Cannot execute fast export due to missing module importlib.machinery #314

Closed lefebvresam closed 9 months ago

lefebvresam commented 9 months ago

I'm using python 3.8.10 in a docker session "ghcr.io/armmbed/mbed-os-env:master-latest".

When executing an export, I get the following message:

root@ee5cf73f49d8:/var/mbed/RA8875_git# /var/mbed/fast-export/hg-fast-export.sh -r /var/mbed/RA8875 -A /var/mbed/authors
Traceback (most recent call last):
  File "/var/mbed/fast-export/hg-fast-export.py", line 13, in <module>
    import pluginloader
  File "/var/mbed/fast-export/pluginloader/__init__.py", line 2, in <module>
    import importlib.machinery
ImportError: No module named machinery
/usr/lib/git-core/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:          2360 KiB
       pools:          2048 KiB
     objects:           312 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit      = 35184372088832
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
---------------------------------------------------------------------
frej commented 9 months ago

I think this problem should be fixed with the patch in #316, please test it @lefebvresam and report back. #315 should help avoid this kind of problem in the future.

frej commented 9 months ago

Merged this without confirmation, as running code which requires Python 3 with a Python 2 interpreter is sure to break things.

lefebvresam commented 9 months ago

After cheking out the project again it's working. The only point is that the docker session is not persitent and I have to do 'pip install mercurial' every time I start the docker session. So I decided to not use the docker session anymore. Another remark is that the tool cannot automatically convert multiple heads from Mercurial into branches, which are understandable in GIT. You have to do for every head:

# (1) Unnamed heads:
# Git can only have one head, hg can have multiple heads in one branch.
# We will convert the unnamed heads into named branches.
# You can also ignore the head with option --ignore-unnamed-heads but you end up with commits being lost
hg update -r 174
hg branch r174-fix-git-conversion
hg commit -m "Fix git conversion (unnamed head r174)"
hg update default
# repeat for each unnamed head
frej commented 9 months ago

the tool cannot automatically convert multiple heads from Mercurial into branches

Check this section of the README for ways to deal with multiple heads.

lefebvresam commented 9 months ago

Ok I suppose that these tools are doing exactly the same what I did manually.

frej commented 9 months ago

More or less.