tortoisehg with hg-git

169 views
Skip to first unread message

Connor Kalina

unread,
May 7, 2021, 2:24:23 PM5/7/21
to hg-git
Hello,
I'm having some major trouble getting hggit to work with tortoise.  I've tried all I can think of, can anyone confirm that it is possible to get hg-git to work with tortoisehg currently.  

It seems the main issue stems from tortoise using it's own python 2.7 environment with its own library.  I've tried using the python 2 compatible hg git version with old dulwich that work with python 2.7.  
when I run 
I get 
"abort: getaddrinfo failed". 

When I use old dulwich (0.10.0) and run 
I get:

  File "C:/Users/Connor/Desktop\hggit\_ssh.py", line 25, in run_command
    command = command.encode(SSHGitClient.DEFAULT_ENCODING)
AttributeError: 'list' object has no attribute 'encode'

Using latest dulwich:  
File "C:\Program Files\TortoiseHg\lib\library.zip\dulwich\objects.py", line 154
    def object_header(num_type: int, length: int) -> bytes:

Any suggestions? Or just give me a confirmation that it's possible to work?
                              ^

Dan Villiom Podlaski Christiansen

unread,
May 7, 2021, 2:27:02 PM5/7/21
to noreply-spamdigest via hg-git, Connor Kalina
Hi

On 7 May 2021, at 20.24, Connor Kalina <hunte...@gmail.com> wrote:
>
> Hello,
> I'm having some major trouble getting hggit to work with tortoise. I've tried all I can think of, can anyone confirm that it is possible to get hg-git to work with tortoisehg currently.
>
> It seems the main issue stems from tortoise using it's own python 2.7 environment with its own library. I've tried using the python 2 compatible hg git version with old dulwich that work with python 2.7.
> when I run
> hg clone git://https://github.com/cjk94/first-blazor.github.io

This looks wrong, it should be:

git+https://github.com/cjk94/first-blazor.github.io

Does that work?

> I get
> "abort: getaddrinfo failed".
>
> When I use old dulwich (0.10.0) and run
> hg clone git+ssh/https://github.com/cjk94/first-blazor.github.io
> I get:
>
> File "C:/Users/Connor/Desktop\hggit\_ssh.py", line 25, in run_command
> command = command.encode(SSHGitClient.DEFAULT_ENCODING)
> AttributeError: 'list' object has no attribute 'encode'
>
> Using latest dulwich:
> File "C:\Program Files\TortoiseHg\lib\library.zip\dulwich\objects.py", line 154
> def object_header(num_type: int, length: int) -> bytes:
>
> Any suggestions? Or just give me a confirmation that it's possible to work?
> ^
>
>
> --
> You received this message because you are subscribed to the Google Groups "hg-git" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hg-git+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hg-git/0f4fb08a-acf4-4b48-855c-d35c9b35beb2n%40googlegroups.com.

--

Dan Villiom Podlaski Christiansen
dan...@gmail.com+45 2728 9771

Connor Kalina

unread,
May 7, 2021, 2:39:01 PM5/7/21
to hg-git
Accidently sent email directly to you, resending here. 

Thanks for the quick response.  
With dulwich 0.10.0 i get
  File "hgdemandimport\demandimportpy2.pyo", line 158, in __getattr__
AttributeError: 'module' object has no attribute 'uname'

With latest dulwich i still get  the same
  File "C:\Program Files\TortoiseHg\lib\library.zip\dulwich\objects.py", line 154
    def object_header(num_type: int, length: int) -> bytes:
                              ^
SyntaxError: invalid syntax

Dan Villiom Podlaski Christiansen

unread,
May 7, 2021, 2:45:21 PM5/7/21
to noreply-spamdigest via hg-git, Connor Kalina
On 7 May 2021, at 20.39, Connor Kalina <hunte...@gmail.com> wrote:

> Accidently sent email directly to you, resending here.
>
> Thanks for the quick response.
> With dulwich 0.10.0 i get
> File "hgdemandimport\demandimportpy2.pyo", line 158, in __getattr__
> AttributeError: 'module' object has no attribute 'uname'
>
> With latest dulwich i still get the same
> File "C:\Program Files\TortoiseHg\lib\library.zip\dulwich\objects.py", line 154
> def object_header(num_type: int, length: int) -> bytes:
> ^
> SyntaxError: invalid syntax

The oldest version of Dulwich that works with hg-git is 0.19.1; the last version to support Python 2.7 is 0.19.16. That syntax error is caused by using a newer Dulwich in Python 2, and judging from their sources,[1] TortoiseHg should be using the correct version. Perhaps try reinstalling it?

[1] https://foss.heptapod.net/mercurial/tortoisehg/thg/-/blob/branch/stable/contrib/packaging/venv_py2/requirements_hggit.txt

>
>> On Friday, May 7, 2021 at 2:27:02 PM UTC-4 dan...@gmail.com wrote:
>> Hi
>>
>> On 7 May 2021, at 20.24, Connor Kalina <hunte...@gmail.com> wrote:
>> >
>> > Hello,
>> > I'm having some major trouble getting hggit to work with tortoise. I've tried all I can think of, can anyone confirm that it is possible to get hg-git to work with tortoisehg currently.
>> >
>> > It seems the main issue stems from tortoise using it's own python 2.7 environment with its own library. I've tried using the python 2 compatible hg git version with old dulwich that work with python 2.7.
>> > when I run
>> > hg clone git://https://github.com/cjk94/first-blazor.github.io
>>
>> This looks wrong, it should be:
>>
>> git+https://github.com/cjk94/first-blazor.github.io
>>
>> Does that work?
>>
>> > I get
>> > "abort: getaddrinfo failed".
>> >
>> > When I use old dulwich (0.10.0) and run
>> > hg clone git+ssh/https://github.com/cjk94/first-blazor.github.io
>> > I get:
>> >
>> > File "C:/Users/Connor/Desktop\hggit\_ssh.py", line 25, in run_command
>> > command = command.encode(SSHGitClient.DEFAULT_ENCODING)
>> > AttributeError: 'list' object has no attribute 'encode'
>> >
>> > Using latest dulwich:
>> > File "C:\Program Files\TortoiseHg\lib\library.zip\dulwich\objects.py", line 154
>> > def object_header(num_type: int, length: int) -> bytes:
>> >
>> > Any suggestions? Or just give me a confirmation that it's possible to work?

Connor Kalina

unread,
May 7, 2021, 3:01:00 PM5/7/21
to hg-git
Well this is farther then i've gotten so far, I manually installed all the requirements with those versions.

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /cjk94/first-blazor.github.io/info/refs?service=git-upload-pack (Caused by SSLError(IOError(2, 'No such file or directory'),))
cmdserver: process exited unexpectedly with code 255

Dan Villiom Podlaski Christiansen

unread,
May 7, 2021, 3:18:10 PM5/7/21
to noreply-spamdigest via hg-git, Connor Kalina
Which version of hg-git are you using? That error suggests you may be using an earlier version. As far as I know, TortoiseHg should work out-of-the-box with hg-git 0.10.0. As mentioned earlier, I think the best course of action is to reinstall it, and then make sure you're using the latest version of hg-git.

--
You received this message because you are subscribed to the Google Groups "hg-git" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hg-git+un...@googlegroups.com.

Connor Kalina

unread,
May 7, 2021, 3:36:30 PM5/7/21
to hg-git
I'm using the latest version, py2 version.  I just reinstalled tortoise and redownloaded all the dependencies.  If i just link tortoise to hggit, it tells me I need dulwich.  So i put all dependencies in tortoise's library.zip so it's python env can use them.  And I'm still getting this 
* unknown exception encountered, please report by visiting
** Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 5.7)
** Extensions loaded: hggit 0.10.0 (dulwich 0.19.16), tortoisehg.util.hgcommands, tortoisehg.util.hgdispatch, tortoisehg.util.partialcommit, tortoisehg.util.pipeui, tortoisehg.util.win32ill
** unknown exception encountered, please report by visiting
** Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 5.7)
** Extensions loaded: hggit 0.10.0 (dulwich 0.19.16), tortoisehg.util.hgcommands, tortoisehg.util.hgdispatch, tortoisehg.util.partialcommit, tortoisehg.util.pipeui, tortoisehg.util.win32ill
Traceback (most recent call last):
  File "hg", line 58, in <module>
  File "mercurial\dispatch.pyo", line 143, in run
  File "mercurial\dispatch.pyo", line 245, in dispatch
  File "mercurial\dispatch.pyo", line 289, in _rundispatch
  File "mercurial\dispatch.pyo", line 465, in _runcatch
  File "mercurial\dispatch.pyo", line 475, in _callcatch
  File "mercurial\scmutil.pyo", line 155, in callcatch
  File "mercurial\dispatch.pyo", line 455, in _runcatchfunc
  File "mercurial\dispatch.pyo", line 1259, in _dispatch
  File "mercurial\dispatch.pyo", line 913, in runcommand
  File "mercurial\dispatch.pyo", line 1270, in _runcommand
  File "mercurial\dispatch.pyo", line 1256, in <lambda>
  File "mercurial\util.pyo", line 1867, in check
  File "mercurial\commands.pyo", line 6421, in serve
  File "mercurial\server.pyo", line 164, in runservice
  File "mercurial\commandserver.pyo", line 469, in run
  File "mercurial\commandserver.pyo", line 403, in serve
  File "mercurial\commandserver.pyo", line 377, in serveone
  File "mercurial\commandserver.pyo", line 358, in runcommand
  File "mercurial\commandserver.pyo", line 297, in _dispatchcommand
  File "mercurial\dispatch.pyo", line 245, in dispatch
  File "mercurial\dispatch.pyo", line 289, in _rundispatch
  File "mercurial\dispatch.pyo", line 465, in _runcatch
  File "mercurial\dispatch.pyo", line 475, in _callcatch
  File "mercurial\scmutil.pyo", line 155, in callcatch
  File "mercurial\dispatch.pyo", line 455, in _runcatchfunc
  File "tortoisehg\util\hgdispatch.pyo", line 23, in _dispatch
  File "mercurial\dispatch.pyo", line 1259, in _dispatch
  File "mercurial\dispatch.pyo", line 913, in runcommand
  File "mercurial\dispatch.pyo", line 1270, in _runcommand
  File "mercurial\dispatch.pyo", line 1256, in <lambda>
  File "mercurial\util.pyo", line 1867, in check
  File "mercurial\commands.pyo", line 1938, in clone
  File "mercurial\hg.pyo", line 949, in clone
  File "mercurial\extensions.pyo", line 512, in closure
  File "C:/Users/Connor/Desktop\hggit\util.py", line 63, in inner
    return f(*args, **kwargs)
  File "C:/Users/Connor/Desktop\hggit\__init__.py", line 480, in exchangepull
    pullop.cgresult = repo.githandler.fetch(remote.path, heads)
  File "C:/Users/Connor/Desktop\hggit\git_handler.py", line 297, in fetch
    result = self.fetch_pack(remote, heads)
  File "C:/Users/Connor/Desktop\hggit\git_handler.py", line 1234, in fetch_pack
    graphwalker, f.write, progress.progress)
  File "C:/Users/Connor/Desktop\hggit\git_handler.py", line 1264, in _call_client
    return func(path, *args, **kwargs)
  File "C:\Program Files\TortoiseHg\lib\library.zip\dulwich\client.py", line 1751, in fetch_pack
  File "C:\Program Files\TortoiseHg\lib\library.zip\dulwich\client.py", line 1629, in _discover_references
  File "C:\Program Files\TortoiseHg\lib\library.zip\dulwich\client.py", line 1593, in _http_request
  File "C:\Program Files\TortoiseHg\lib\library.zip\urllib3\request.py", line 76, in request
  File "C:\Program Files\TortoiseHg\lib\library.zip\urllib3\request.py", line 97, in request_encode_url
  File "C:\Program Files\TortoiseHg\lib\library.zip\urllib3\poolmanager.py", line 336, in urlopen
  File "C:\Program Files\TortoiseHg\lib\library.zip\urllib3\connectionpool.py", line 767, in urlopen
  File "C:\Program Files\TortoiseHg\lib\library.zip\urllib3\connectionpool.py", line 767, in urlopen
  File "C:\Program Files\TortoiseHg\lib\library.zip\urllib3\connectionpool.py", line 767, in urlopen
  File "C:\Program Files\TortoiseHg\lib\library.zip\urllib3\connectionpool.py", line 727, in urlopen
  File "C:\Program Files\TortoiseHg\lib\library.zip\urllib3\util\retry.py", line 446, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /cjk94/first-blazor.github.io/info/refs?service=git-upload-pack (Caused by SSLError(IOError(2, 'No such file or directory'),))
cmdserver: process exited unexpectedly with code 255




Matt Harbison

unread,
May 8, 2021, 2:49:25 AM5/8/21
to hg-git
Modifying library.zip is unnecessary (and ill-advised since it means you have to do it again when upgrading thg).  Instead, use the requirements.txt file that was pointed out earlier in the thread.  The critical bit is to install it with py2.7 and use the `--user` arg:

    py -2.7 -m pip install --user -U -r contrib/packaging/venv_py2/requirements_hggit.txt

I'm not sure what you mean by "manually installing" the dependencies.  If you ran `pip install` commands on the individual pieces, you may need to uninstall them first (but maybe -U will take care of that for you).  By using the file directly to install, it will install specific versions that worked when I last tested this.  At one point, I think certifi was also causing issues with hg-git and thg on Windows.

Dan Villiom Podlaski Christiansen

unread,
May 8, 2021, 5:14:50 AM5/8/21
to noreply-spamdigest via hg-git, Matt Harbison
Generally speaking, the following should be sufficient for installing hg-git:

$ python -m pip install hg-git

…and to install it in the user profile:

$ python -m pip install --user hg-git

(I'm unsure how TortoiseHg installs its Python VM on Windows, but I've assumed that it gets added to %PATH% as ‘python’.) hg-git itself has a single dependency, Dulwich, and it's specified as:

    install_requires=[
        'dulwich>=0.19.0;python_version>="3.0"',
        'dulwich>=0.19.0,<0.20.0;python_version<"3.0"',
    ],

There is no need to manually install any dependencies, Pip will handle that. The only issue is that unless you have a C compiler and everything, you'll need a binary wheel. Dulwich 0.19.6 has multiple available, including a Python 2.7 wheel for Windows/x86:


So, the steps to use hg-git with TortoiseHg should be:

  1. Install the 32-bit version of TortoiseHg.
  2. Install hg-git using pip --user.
  3. Enable it in your configuration.
  4. Profit!

Matt Harbison

unread,
May 8, 2021, 9:35:24 PM5/8/21
to Dan Villiom Podlaski Christiansen, noreply-spamdigest via hg-git
On Sat, May 8, 2021 at 5:14 AM Dan Villiom Podlaski Christiansen
<dan...@gmail.com> wrote:
>
> Generally speaking, the following should be sufficient for installing hg-git:
>
> $ python -m pip install --user hg-git

Can confirm that this works, except there's a demandimport issue on Windows:

$ hg.exe --config extensions.hggit= clone
https://bitbucket.org/tortoisehg/tortoisehg.bitbucket.io.git
/tmp/thg-html --traceback
Traceback (most recent call last):
File "mercurial\scmutil.pyo", line 155, in callcatch
File "mercurial\dispatch.pyo", line 460, in _runcatchfunc
File "mercurial\dispatch.pyo", line 1264, in _dispatch
File "mercurial\dispatch.pyo", line 918, in runcommand
File "mercurial\dispatch.pyo", line 1275, in _runcommand
File "mercurial\dispatch.pyo", line 1261, in <lambda>
File "mercurial\util.pyo", line 1883, in check
File "mercurial\commands.pyo", line 1976, in clone
File "mercurial\hg.pyo", line 957, in clone
File "mercurial\extensions.pyo", line 512, in closure
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\hggit\util.py",
line 63, in inner
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\hggit\__init__.py",
line 480, in exchangepull
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\hggit\git_handler.py",
line 297, in fetch
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\hggit\git_handler.py",
line 1234, in fetch_pack
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\hggit\git_handler.py",
line 1264, in _call_client
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\dulwich\client.py",
line 1751, in fetch_pack
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\dulwich\client.py",
line 1629, in _discover_references
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\dulwich\client.py",
line 1593, in _http_request
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\request.py",
line 76, in request
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\request.py",
line 97, in request_encode_url
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\poolmanager.py",
line 330, in urlopen
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\connectionpool.py",
line 672, in urlopen
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\connectionpool.py",
line 376, in _make_request
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\connectionpool.py",
line 994, in _validate_conn
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\connection.py",
line 386, in connect
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\connection.py",
line 396, in _match_hostname
File "C:\Users\Matt\AppData\Roaming\Python\Python27\site-packages\urllib3\packages\ssl_match_hostname\_implementation.py",
line 113, in match_hostname
File "hgdemandimport\demandimportpy2.pyo", line 157, in __getattr__
File "hgdemandimport\demandimportpy2.pyo", line 97, in _load
File "hgdemandimport\demandimportpy2.pyo", line 44, in _hgextimport
ImportError: No module named ipaddress
abort: No module named ipaddress

It cloned fine once I disabled demandimport. It's the latest package
on pypi, and I uninstalled ipaddress and brotli from the site-package
before installing hg-git.

$ hg version -v --config extensions.hggit=
Mercurial Distributed SCM (version 5.8rc0)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2021 Olivia Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Enabled extensions:

absorb internal
blackbox internal
evolve external 10.3.1
extdiff internal
fix internal
hggit external 0.10.0 (dulwich 0.19.16)
mercurial_keyring external
mq internal
phabblocker external 20210126
phabricator internal
rebase internal
show internal
strip internal
topic external 0.22.1

> (I'm unsure how TortoiseHg installs its Python VM on Windows, but I've assumed that it gets added to %PATH% as ‘python’.)

There's no python.exe- it's py2exe generated binaries named hg.exe and
thg.exe that load python27.dll and read *.pyc files from library.zip.
Recent versions of hg and thg (maybe since Nov 2020) add the user site
to sys.path, so if you have a full python2 installation, you can
install anything you want without hacking library.zip. I know there's
an extension in mercurial/contrib that may be a proper debug command
in 5.8 that gives you access to the REPL, and maybe that can be used
to pip install stuff if you don't have a standalone py2 installation.

If you feel comfortable with maintaining hg-git and can get it
compatible with the latest releases shortly after the hg release going
forward, I can look at bundling this again. I only took it out
because it was always broken for weeks after the release, and it
seemed better if people had the opportunity to pick up the latest
fixes as they became available.

Dan Villiom Podlaski Christiansen

unread,
May 10, 2021, 3:32:01 AM5/10/21
to Matt Harbison, noreply-spamdigest via hg-git
On 9 May 2021, at 03.35, Matt Harbison <mharb...@gmail.com> wrote:

> On Sat, May 8, 2021 at 5:14 AM Dan Villiom Podlaski Christiansen
> <dan...@gmail.com> wrote:
>>
>> Generally speaking, the following should be sufficient for installing hg-git:
>>
>> $ python -m pip install --user hg-git
>
> Can confirm that this works, except there's a demandimport issue on Windows:
[snip]
> abort: No module named ipaddress
>
> It cloned fine once I disabled demandimport. It's the latest package
> on pypi, and I uninstalled ipaddress and brotli from the site-package
> before installing hg-git.

Sigh… Yet another issue with demandimport on Python 2…

I've added a commit to our 5.8 MR that fixes this:

https://foss.heptapod.net/mercurial/hg-git/-/merge_requests/100/diffs?commit_id=c8f7a99fd1ad78e3ef4bbbff9c03a4360e749c23

[snip]
>> (I'm unsure how TortoiseHg installs its Python VM on Windows, but I've assumed that it gets added to %PATH% as ‘python’.)
>
> There's no python.exe- it's py2exe generated binaries named hg.exe and
> thg.exe that load python27.dll and read *.pyc files from library.zip.
> Recent versions of hg and thg (maybe since Nov 2020) add the user site
> to sys.path, so if you have a full python2 installation, you can
> install anything you want without hacking library.zip. I know there's
> an extension in mercurial/contrib that may be a proper debug command
> in 5.8 that gives you access to the REPL, and maybe that can be used
> to pip install stuff if you don't have a standalone py2 installation.

Ah okay. We should probably have some specific instructions for using the latest hg-git with TortoiseHg in our README since the regular instructions using pip don't quite apply.

> If you feel comfortable with maintaining hg-git and can get it
> compatible with the latest releases shortly after the hg release going
> forward, I can look at bundling this again. I only took it out
> because it was always broken for weeks after the release, and it
> seemed better if people had the opportunity to pick up the latest
> fixes as they became available.

We currently have some issues with getting MRs in, so I can't promise anything. I do expect to have a 0.10.1 released by the end of this week that works with Mercurial 5.8. I think the most important part is that you bundle Dulwich; with that, it should be relatively easy to get hg-git working.

Going forward, we should have the infrastructure in place to notice any breakage with default prior to the release. But until the review situation improves, it's hard for me to make any promises w.r.t. actually fixing them, sorry.

--

Dan Villiom Podlaski Christiansen
dan...@gmail.com+45 2728 9771

Reply all
Reply to author
Forward
0 new messages