How do I correctly install dulwich to get hg-git working on Windows?

后端 未结 10 2042
执念已碎
执念已碎 2021-01-31 01:35

I\'m trying to use the hg-git Mercurial extension on Windows (Windows 7 64-bit, to be specific). I have Mercurial and Git installed. I have Python 2.5 (32-bit) installed.

<
10条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 02:24

    That makes me think dulwich is not installed correctly, or not in the path.

    You're absolutely right. Mercurial binary distributions for Windows are 'frozen' - they use the Python code and interpreter bundled with them and therefore independent of packages installed in system PYTHONPATH. When you specify path to hggit extension in Mercurial.ini, hg tries to import it using direct path, but dulwich library is not imported explicitly by hg and doesn't bundled with its library, so the import fails.

    It is possible to add both Dulwich and HgGit into library.zip that is installed along with hg.exe, but for me the best way is to install everything from source including Mercurial and execute commands using .bat files installed into \Python\Scripts. In this case you will need to:

    1. Install Mercurial from source. This builds "pure" version, because Windows users usually don't have Visual Studio or alternative compiler for compiling C speedups.
    2. Install Dulwich - I'd use latest trunk snapshot for both Git and Dulwich.

      python setup.py --pure install

    3. Install latest HgGit snapshot

      python setup.py install

    4. Edit Mercurial.ini to enable hggit =

    5. Launch Mercurial using your \Python\Scripts\hg.bat

提交回复
热议问题