4
votes

I am trying to convert Hg repository to Git repository. Both are private repository.

I have followed these steps (reference):

  • Step 1: Set up your repositories

  • Step 2: Install the Mercurial hggit plugin

  • Step 3: Push your code into your Git repository

  • Step 4: Switch your local repository to use Git

I have installed the prerequisites also viz. hg-git plugin and updated the .hgrc file of the repository that needs to convert.

Error coming while pushing the repository( hg push [Git repo path] ) is "abort: No module named selectors!"

I have used --traceback option, please find the log below:

E:\BK_Hg\testHg>hg push --traceback https://[email protected]/CJbipin/testgit2.git
pushing to https://[email protected]/CJbipin/testgit2.git
Traceback (most recent call last):
File "mercurial\scmutil.pyo", line 161, in callcatch
File "mercurial\dispatch.pyo", line 344, in _runcatchfunc
File "mercurial\dispatch.pyo", line 984, in _dispatch
File "mercurial\dispatch.pyo", line 730, in runcommand
File "mercurial\dispatch.pyo", line 992, in _runcommand
File "mercurial\dispatch.pyo", line 981, in <lambda>
File "mercurial\util.pyo", line 1528, in check
File "mercurial\commands.pyo", line 4369, in push
File "E:/hg-git\hggit\util.py", line 60, in inner
File "E:/hg-git\hggit\__init__.py", line 414, in exchangepush
File "E:/hg-git\hggit\git_handler.py", line 405, in push
File "E:/hg-git\hggit\git_handler.py", line 1063, in upload_pack
File "E:/hg-git\hggit\git_handler.py", line 1749, in get_transport_and_path
File "dulwich\client.pyo", line 1330, in __init__
File "dulwich\client.pyo", line 1304, in default_urllib3_manager
File "hgdemandimport\demandimportpy2.pyo", line 167, in _demandimport
File "hgdemandimport\demandimportpy2.pyo", line 41, in _hgextimport
File "urllib3\__init__.pyo", line 8, in <module>
File "hgdemandimport\demandimportpy2.pyo", line 243, in _demandimport
File "hgdemandimport\demandimportpy2.pyo", line 41, in _hgextimport
File "urllib3\connectionpool.pyo", line 29, in <module>
File "hgdemandimport\demandimportpy2.pyo", line 243, in _demandimport
File "hgdemandimport\demandimportpy2.pyo", line 41, in _hgextimport
File "urllib3\connection.pyo", line 39, in <module>
File "hgdemandimport\demandimportpy2.pyo", line 243, in _demandimport
File "hgdemandimport\demandimportpy2.pyo", line 41, in _hgextimport
File "urllib3\util\__init__.pyo", line 3, in <module>
File "hgdemandimport\demandimportpy2.pyo", line 243, in _demandimport
File "hgdemandimport\demandimportpy2.pyo", line 41, in _hgextimport
File "urllib3\util\connection.pyo", line 3, in <module>
File "hgdemandimport\demandimportpy2.pyo", line 243, in _demandimport
File "hgdemandimport\demandimportpy2.pyo", line 41, in _hgextimport
File "urllib3\util\wait.pyo", line 1, in <module>
File "hgdemandimport\demandimportpy2.pyo", line 243, in _demandimport
File "hgdemandimport\demandimportpy2.pyo", line 41, in _hgextimport
ImportError: No module named selectors
abort: No module named selectors!

regards Bipin Kumar

1
Run hg-git with Python 3.phd
i have tried with python also, version 3.7.3 but same error is coming.BKT
Patch from comments in issue, noted by @phd, helped me with GIt-repos (I could cloneit without errors). Win10x64, THG 4.9.1Lazy Badger

1 Answers

2
votes

Because even in released THG 5.0.2 bundled hg-git sill have the same problem:

THG 5 solutions in details, step-by-step

Lazy fast way

  • Download patched full lib for THG 4.9.1 from comment in BB's issue
  • Replace dulwich + urllib3 in your THG's library archive by patched version from the above library
  • If after it clone attempt of git-repo raised "urllib3.exceptions.MaxRetryError" error then remove certifi or use certifi from patch

Longer more pure way

  • unpack library.zip
  • replace urllib3 with 1.24.1 (download, compile, replace old *.pyo)
  • replace dulwich with same content from https://github.com/dulwich/dulwich/, latest 0.19.11, (download, compile, replace old *.pyo)
  • We have don't replace hg-git, because bundled hggit contains latest compatibility fixes for Mercurial 5 (while dmitriyse's version don't have yet)
  • remove certify
  • re-pack library