mercurial_keyring issueshttps://foss.heptapod.net/mercurial/mercurial_keyring/-/issues2023-03-01T20:36:21Zhttps://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/83UnicodeDecodeError when installing 1.4.3 from PyPI on CentOS 7.9 with py3.6.82023-03-01T20:36:21ZMatt HarbisonUnicodeDecodeError when installing 1.4.3 from PyPI on CentOS 7.9 with py3.6.8```
$ python3 -V
Python 3.6.8
$ python3 -m pip -V
pip 21.3.1 from /usr/share/tomcat/.local/lib/python3.6/site-packages/pip (python 3.6)
$ python3 -m pip list | grep setuptools
setuptools 59.6.0
$ python3 -m pip install mercurial_keyring...```
$ python3 -V
Python 3.6.8
$ python3 -m pip -V
pip 21.3.1 from /usr/share/tomcat/.local/lib/python3.6/site-packages/pip (python 3.6)
$ python3 -m pip list | grep setuptools
setuptools 59.6.0
$ python3 -m pip install mercurial_keyring --user -U
Collecting mercurial_keyring
Using cached mercurial_keyring-1.4.3.tar.gz (29 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5y9inm1e/mercurial-keyring_4eb665955d8447419969a58edd77c583/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5y9inm1e/mercurial-keyring_4eb665955d8447419969a58edd77c583/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-jfqcos46
cwd: /tmp/pip-install-5y9inm1e/mercurial-keyring_4eb665955d8447419969a58edd77c583/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-5y9inm1e/mercurial-keyring_4eb665955d8447419969a58edd77c583/setup.py", line 6, in <module>
LONG_DESCRIPTION = open("README.rst").read()
File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 2574: ordinal not in range(128)
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/79/f1/aa99599dd61f2379a70df1f855ce03db7af74c54b8e9bacd0d2ba283008a/mercurial_keyring-1.4.3.tar.gz#sha256=deb5cdfe81f660099efafb0802e194c8ec52f54802b53a812c3565dbce5c83c7 (from https://pypi.org/simple/mercurial-keyring/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading mercurial_keyring-1.4.2.tar.gz (29 kB)
Preparing metadata (setup.py) ... error
ERROR: Command errored out with exit status 1:
....
```
... and it loops discarding the current version, and trying N-1, N-2, ...
I know I've installed from PyPI on other platforms, and I think even other Linux systems with py3.7 or later, so maybe it's a 3.6 issue. But it might be easier to just keep the readme ASCII.https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/82broken as usual after upgrading Mercurial2022-03-27T03:27:08Zphp4fanbroken as usual after upgrading MercurialI upgraded TortoiseHG to the latest version, so then I upgraded Mercurial to 6.1 wich was required (5.9.something at least) by THG.
As usual, like every single time I have upgraded Mercurial, mercurial_keyring stopped working. I got the...I upgraded TortoiseHG to the latest version, so then I upgraded Mercurial to 6.1 wich was required (5.9.something at least) by THG.
As usual, like every single time I have upgraded Mercurial, mercurial_keyring stopped working. I got the error message below.
So I upgraded mercurial_keyring too, to version 1.4.1 (that's what I got by running "pip install --upgrade mercurial_keyring") and I get the exact same error message (with only some line numbers changed).
The error I paste is the one I get with keyring v. 1.4.1:
```
% hg pull --verbose https://xp-dev.com/hg/XXXXX
pulling from https://xp-dev.com/hg/XXXXX
** Unknown exception encountered with possibly-broken third-party extension "mercurial_keyring" (version N/A)
** which supports versions unknown of Mercurial.
** Please disable "mercurial_keyring" and try your action again.
** If that fixes the bug please report it to https://foss.heptapod.net/mercurial/mercurial_keyring/issues
** Python 3.8.12 (default, Aug 31 2021, 01:23:42) [GCC]
** Mercurial Distributed SCM (version 6.1)
** Extensions loaded: mercurial_keyring, tortoisehg.util.hgcommands, tortoisehg.util.hgdispatch, tortoisehg.util.partialcommit, tortoisehg.util.pipeui
** Unknown exception encountered with possibly-broken third-party extension "mercurial_keyring" (version N/A)
** which supports versions unknown of Mercurial.
** Please disable "mercurial_keyring" and try your action again.
** If that fixes the bug please report it to https://foss.heptapod.net/mercurial/mercurial_keyring/issues
** Python 3.8.12 (default, Aug 31 2021, 01:23:42) [GCC]
** Mercurial Distributed SCM (version 6.1)
** Extensions loaded: mercurial_keyring, tortoisehg.util.hgcommands, tortoisehg.util.hgdispatch, tortoisehg.util.partialcommit, tortoisehg.util.pipeui
Traceback (most recent call last):
File "/home/teo/.local/bin/hg", line 61, in <module>
dispatch.run()
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 144, in run
status = dispatch(req)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 250, in dispatch
status = _rundispatch(req)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 294, in _rundispatch
ret = _runcatch(req) or 0
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 470, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 480, in _callcatch
return scmutil.callcatch(ui, func)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/scmutil.py", line 153, in callcatch
return func()
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 460, in _runcatchfunc
return _dispatch(req)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 1273, in _dispatch
return runcommand(
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 918, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 1285, in _runcommand
return cmdfunc()
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 1271, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/util.py", line 1887, in check
return func(*args, **kwargs)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/commands.py", line 6595, in serve
return server.runservice(opts, initfn=service.init, runfn=service.run)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/server.py", line 167, in runservice
return runfn()
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/commandserver.py", line 469, in run
return sv.serve()
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/commandserver.py", line 403, in serve
while self.serveone():
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/commandserver.py", line 377, in serveone
handler(self)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/commandserver.py", line 358, in runcommand
ret = self._dispatchcommand(req) & 255
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/commandserver.py", line 297, in _dispatchcommand
return dispatch.dispatch(req)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 250, in dispatch
status = _rundispatch(req)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 294, in _rundispatch
ret = _runcatch(req) or 0
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 470, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 480, in _callcatch
return scmutil.callcatch(ui, func)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/scmutil.py", line 153, in callcatch
return func()
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 460, in _runcatchfunc
return _dispatch(req)
File "/home/teo/programmi/thg/tortoisehg/util/hgdispatch.py", line 23, in _dispatch
return orig(req)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 1273, in _dispatch
return runcommand(
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 918, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 1285, in _runcommand
return cmdfunc()
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/dispatch.py", line 1271, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/util.py", line 1887, in check
return func(*args, **kwargs)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/commands.py", line 5407, in pull
other = hg.peer(repo, opts, source)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/hg.py", line 239, in peer
return _peerorrepo(
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/hg.py", line 187, in _peerorrepo
obj = _peerlookup(path).instance(
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/httppeer.py", line 645, in instance
inst = makepeer(ui, path)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/httppeer.py", line 629, in makepeer
respurl, info = performhandshake(ui, url, opener, requestbuilder)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/httppeer.py", line 568, in performhandshake
resp = sendrequest(ui, opener, req)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/httppeer.py", line 288, in sendrequest
res = opener.open(req)
File "/usr/lib64/python3.8/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib64/python3.8/urllib/request.py", line 640, in http_response
response = self.parent.error(
File "/usr/lib64/python3.8/urllib/request.py", line 563, in error
result = self._call_chain(*args)
File "/usr/lib64/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/lib64/python3.8/urllib/request.py", line 1062, in http_error_401
response = self.http_error_auth_reqed('www-authenticate',
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/url.py", line 524, in http_error_auth_reqed
return urlreq.httpbasicauthhandler.http_error_auth_reqed(
File "/home/teo/.local/lib/python3.8/site-packages/mercurial_keyring.py", line 625, in basic_http_error_auth_reqed
return basic_http_error_auth_reqed.orig(self, authreq, host, req, headers)
File "/usr/lib64/python3.8/urllib/request.py", line 1011, in http_error_auth_reqed
return self.retry_http_basic_auth(host, req, realm)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial/url.py", line 529, in retry_http_basic_auth
user, pw = self.passwd.find_user_password(
File "/home/teo/.local/lib/python3.8/site-packages/mercurial_keyring.py", line 616, in find_user_password
return self._pwd_handler.find_auth(self, realm, authuri, req)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial_keyring.py", line 432, in find_auth
user, pwd, src, final_url = self.get_credentials(
File "/home/teo/.local/lib/python3.8/site-packages/mercurial_keyring.py", line 346, in get_credentials
parsed_url, url_user, url_passwd = self.unpack_url(authuri)
File "/home/teo/.local/lib/python3.8/site-packages/mercurial_keyring.py", line 575, in unpack_url
parsed_url = util.url(authuri)
AttributeError: module 'mercurial.util' has no attribute 'url'
cmdserver: process exited unexpectedly with code 1
```https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/81Exception on push with chg2022-03-16T19:54:33ZÉloi RivardException on push with chgWith the `hg` binary everything works as expected, but with `chg` I get the following error with `chg push`. Disabling the extension fixes the issue with `chg`. I use mercurial 6.1 on archlinux.
```python
$ hg push
pushing to xxxxx
** ...With the `hg` binary everything works as expected, but with `chg` I get the following error with `chg push`. Disabling the extension fixes the issue with `chg`. I use mercurial 6.1 on archlinux.
```python
$ hg push
pushing to xxxxx
** Unknown exception encountered with possibly-broken third-party extension "mercurial_keyring" (version N/A)
** which supports versions unknown of Mercurial.
** Please disable "mercurial_keyring" and try your action again.
** If that fixes the bug please report it to https://foss.heptapod.net/mercurial/mercurial_keyring/issues
** Python 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0]
** Mercurial version 6.1, système de gestion de sources distribué
** Extensions chargées : hgk, mercurial_keyring, mq, pager, patchbomb, purge, rebase, strip
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/mercurial/commandserver.py", line 499, in _serverequest
sv.serve()
File "/usr/lib/python3.10/site-packages/mercurial/commandserver.py", line 403, in serve
while self.serveone():
File "/usr/lib/python3.10/site-packages/mercurial/commandserver.py", line 377, in serveone
handler(self)
File "/usr/lib/python3.10/site-packages/mercurial/chgserver.py", line 583, in runcommand
return super(chgcmdserver, self).runcommand()
File "/usr/lib/python3.10/site-packages/mercurial/commandserver.py", line 358, in runcommand
ret = self._dispatchcommand(req) & 255
File "/usr/lib/python3.10/site-packages/mercurial/commandserver.py", line 297, in _dispatchcommand
return dispatch.dispatch(req)
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 250, in dispatch
status = _rundispatch(req)
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 294, in _rundispatch
ret = _runcatch(req) or 0
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 470, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 480, in _callcatch
return scmutil.callcatch(ui, func)
File "/usr/lib/python3.10/site-packages/mercurial/scmutil.py", line 153, in callcatch
return func()
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 460, in _runcatchfunc
return _dispatch(req)
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 1273, in _dispatch
return runcommand(
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 918, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/lib/python3.10/site-packages/hgext/pager.py", line 78, in pagecmd
return orig(ui, options, cmd, cmdfunc)
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 1285, in _runcommand
return cmdfunc()
File "/usr/lib/python3.10/site-packages/mercurial/dispatch.py", line 1271, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/usr/lib/python3.10/site-packages/mercurial/util.py", line 1887, in check
return func(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/mercurial/util.py", line 1887, in check
return func(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/hgext/mq.py", line 4239, in mqcommand
return orig(ui, repo, *args, **kwargs)
File "/usr/lib/python3.10/site-packages/mercurial/util.py", line 1887, in check
return func(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/mercurial/commands.py", line 5742, in push
other = hg.peer(repo, opts, dest)
File "/usr/lib/python3.10/site-packages/mercurial/hg.py", line 239, in peer
return _peerorrepo(
File "/usr/lib/python3.10/site-packages/mercurial/hg.py", line 187, in _peerorrepo
obj = _peerlookup(path).instance(
File "/usr/lib/python3.10/site-packages/mercurial/httppeer.py", line 645, in instance
inst = makepeer(ui, path)
File "/usr/lib/python3.10/site-packages/mercurial/httppeer.py", line 629, in makepeer
respurl, info = performhandshake(ui, url, opener, requestbuilder)
File "/usr/lib/python3.10/site-packages/mercurial/httppeer.py", line 568, in performhandshake
resp = sendrequest(ui, opener, req)
File "/usr/lib/python3.10/site-packages/mercurial/httppeer.py", line 288, in sendrequest
res = opener.open(req)
File "/usr/lib/python3.10/urllib/request.py", line 525, in open
response = meth(req, response)
File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response
response = self.parent.error(
File "/usr/lib/python3.10/urllib/request.py", line 557, in error
result = self._call_chain(*args)
File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/usr/lib/python3.10/urllib/request.py", line 1056, in http_error_401
response = self.http_error_auth_reqed('www-authenticate',
File "/usr/lib/python3.10/site-packages/mercurial/url.py", line 524, in http_error_auth_reqed
return urlreq.httpbasicauthhandler.http_error_auth_reqed(
File "/usr/lib/python3.10/site-packages/mercurial_keyring.py", line 625, in basic_http_error_auth_reqed
return basic_http_error_auth_reqed.orig(self, authreq, host, req, headers)
File "/usr/lib/python3.10/urllib/request.py", line 1005, in http_error_auth_reqed
return self.retry_http_basic_auth(host, req, realm)
File "/usr/lib/python3.10/site-packages/mercurial/url.py", line 529, in retry_http_basic_auth
user, pw = self.passwd.find_user_password(
File "/usr/lib/python3.10/site-packages/mercurial_keyring.py", line 616, in find_user_password
return self._pwd_handler.find_auth(self, realm, authuri, req)
File "/usr/lib/python3.10/site-packages/mercurial_keyring.py", line 432, in find_auth
user, pwd, src, final_url = self.get_credentials(
File "/usr/lib/python3.10/site-packages/mercurial_keyring.py", line 346, in get_credentials
parsed_url, url_user, url_passwd = self.unpack_url(authuri)
File "/usr/lib/python3.10/site-packages/mercurial_keyring.py", line 575, in unpack_url
parsed_url = util.url(authuri)
AttributeError: module 'mercurial.util' has no attribute 'url'
```https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/80[1.4.1] mercurial_keyring sends byte objects as strings, failing Apache authe...2023-03-21T19:07:51ZJeroen Ruigrok van der Werven[1.4.1] mercurial_keyring sends byte objects as strings, failing Apache authenticationUsing mercurial_keyring 1.4.1 when trying to authenticate against an Apache host I consistently fail to authenticate. This results in Mercurial repeating the following bit on the CLI:
```
http authorization required
realm: Mercurial repo...Using mercurial_keyring 1.4.1 when trying to authenticate against an Apache host I consistently fail to authenticate. This results in Mercurial repeating the following bit on the CLI:
```
http authorization required
realm: Mercurial repositories
url: https://hg.example.com
user: username (fixed in hgrc or url)
password:
```
Checking the Apache logfiles shows that the username is sent verbatim as `b'username'`:
```
user `b'username'' in realm `Mercurial repositories' not found: /reponame
```
The same problem occurs with the password, once I had fixed the above:
```
AH01794: user username: password mismatch: /reponame
```
If I patch it with [mercurial_keyring.py.patch](/uploads/23a3e39da393eae129d3ea1b1c904437/mercurial_keyring.py.patch) it solves these problems and I can also use my keyring as intended. I am not 100% sure if these are the right API calls to make, but they seem to make sense.
Relevant Apache configuration section:
```apache
<Location />
AuthType Digest
AuthName "Mercurial repositories"
AuthDigestProvider file
AuthUserFile "/usr/local/hg/hgusers"
Require valid-user
</Location>
```https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/79Authentication failure with hg-git2021-07-06T10:34:03ZjmbAuthentication failure with hg-gitHi,
I have an issue which prevents me from authenticating on my company's internal Gitlab repositories with Mercurial+hg-git. I was able to track it down to Mercurial using `b'username':b'password'` as the credentials instead of `userna...Hi,
I have an issue which prevents me from authenticating on my company's internal Gitlab repositories with Mercurial+hg-git. I was able to track it down to Mercurial using `b'username':b'password'` as the credentials instead of `username:password`.
I reported a bug to hg-git (hg-git#360) and they asked me to report it here since they expect `find_stored_password` to return a unicode string but mercurial_keyring returns a bytes object instead.
Versions:
- mercurial 5.8
- mercurial-keyring 1.4.1
- dulwich 0.20.21
- hg-git 0.10.1
- Python 3.7.3https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/78Bytes vs str trouble in user names and password2021-05-01T23:54:05ZGabor MarotiBytes vs str trouble in user names and passwordSome data type conversion trouble appears to lurk around (or else I am doing something terribly wrong)
**System:**
Fedora 32, gnome-keyring-3.36.0, python-3.8.7, python3-keyring-21.8.0, mercurial-5.2, mercurial_keyring-1.4.0 (many thank...Some data type conversion trouble appears to lurk around (or else I am doing something terribly wrong)
**System:**
Fedora 32, gnome-keyring-3.36.0, python-3.8.7, python3-keyring-21.8.0, mercurial-5.2, mercurial_keyring-1.4.0 (many thanks for fixing #69!)
**Symptoms:**
`hg incoming` (just like all similar operations) retrieves the password but is unable to use it. Mercurial prompts for the password but can't use the typed password, either, and keeps prompting.
**Vague idea:**
As far as I understand the code, mercurial_keyring uses bytes for user names and passwords. These values find their way to Mercurial proper, but strings seem to be expected there. As a quick test, I changed the return statement of find_user_password() in mercurial_keyring.py:613 to `return b'myusername', b'mypassword'`, and it gives the aforementioned symptoms. However, `return 'myusername', 'mypassword'` works just fine. (BTW, my password consists of letters and digits only, without any crazy upper-half ASCII or Unicode character.)
Thanks in advance for looking at this issue.https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/77Fails with "module object for 'cryptography.utils' substituted in sys.modules...2023-03-27T10:09:16ZChris WesselingFails with "module object for 'cryptography.utils' substituted in sys.modules during a lazy load"I installed mercurial using pipx install and inject.
$ pipx runpip mercurial freeze
cffi==1.14.5
cryptography==3.4.5
jeepney==0.6.0
keyring==22.0.1
mercurial==5.7
mercurial-extension-utils==1.5.1
mercuria...I installed mercurial using pipx install and inject.
$ pipx runpip mercurial freeze
cffi==1.14.5
cryptography==3.4.5
jeepney==0.6.0
keyring==22.0.1
mercurial==5.7
mercurial-extension-utils==1.5.1
mercurial-keyring==1.3.1
pycparser==2.20
SecretStorage==3.3.1
Keyring works fine when tested directly with `$ [...env...]/python -m keyring set/get/del` but hg fails with
> keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: module object for 'cryptography.utils' substituted in sys.modules during a lazy loadhttps://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/76keyring 21.0.6+ broken on macOS with demand import enabled2022-12-09T19:11:33ZMatt Harbisonkeyring 21.0.6+ broken on macOS with demand import enabledThe latest keying module (22.0.1) causes this warning, and a fallback to prompting for the password with py3.9.1:
```
keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: N...The latest keying module (22.0.1) causes this warning, and a fallback to prompting for the password with py3.9.1:
```
keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
```
It works fine if using `HGDEMANDIMPORT=disable`. It was also an issue with the system python 3.7.4. I isolated it to some change in 21.0.6. I see there's a list of things in `mercurial_keyring.py` that are omitted from demandimport, but wasn't sure what needed to be stuffed in there.Marcin KasperskiMarcin Kasperskihttps://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/75Keyring stupidly remembers wrong password and never asks it again2021-02-20T18:40:38Zteo1978Keyring stupidly remembers wrong password and never asks it againSteps to reproduce:
- push to a given repository
- when prompted for the password, accidentally type a wrong one. The push will get rejected because of wrong credentials
- push again
Expected: Upon the failed login attempt, the wrong p...Steps to reproduce:
- push to a given repository
- when prompted for the password, accidentally type a wrong one. The push will get rejected because of wrong credentials
- push again
Expected: Upon the failed login attempt, the wrong password shouldn't be stored into the keyring because it has been rejected so it's obviously the wrong password. Therefore, on the second attempt it should prompt for password as if it was the very first time.
Observed: On the first failed login, the password is stupidly stored to the keyring. Therefore, at the next attempt the wrong stored password will be blindly used without prompting the user, and the login will obviously fail, and I'll never be able to push to that repository ever again until I figure out how to manually delete a password that has been stored.https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/74SMTP support needs to be updated for py32021-03-04T18:24:15ZMatt HarbisonSMTP support needs to be updated for py3I got this when sending an email:
```
** Unknown exception encountered with possibly-broken third-party extension mercurial_keyring
** which supports versions unknown of Mercurial.
** Please disable mercurial_keyring and try your action...I got this when sending an email:
```
** Unknown exception encountered with possibly-broken third-party extension mercurial_keyring
** which supports versions unknown of Mercurial.
** Please disable mercurial_keyring and try your action again.
** If that fixes the bug please report it to https://foss.heptapod.net/mercurial/mercurial_keyring/issues
** Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
** Mercurial Distributed SCM (version 5.5.1)
** Extensions loaded: extdiff, evolve, topic, phabricator, phabblocker, mercurial_keyring, rebase, absorb, blackbox, strip, show, fix, mq, tortoisehg.util.hgcommands, tortoisehg.util.partialcommit, tortoisehg.util.pipeui, tortoisehg.util.win32ill, tortoisehg.util.hgdispatch, patchbomb
** Unknown exception encountered with possibly-broken third-party extension mercurial_keyring
** which supports versions unknown of Mercurial.
** Please disable mercurial_keyring and try your action again.
** If that fixes the bug please report it to https://foss.heptapod.net/mercurial/mercurial_keyring/issues
** Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
** Mercurial Distributed SCM (version 5.5.1)
** Extensions loaded: extdiff, evolve, topic, phabricator, phabblocker, mercurial_keyring, rebase, absorb, blackbox, strip, show, fix, mq, tortoisehg.util.hgcommands, tortoisehg.util.partialcommit, tortoisehg.util.pipeui, tortoisehg.util.win32ill, tortoisehg.util.hgdispatch, patchbomb
Traceback (most recent call last):
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\Scripts\hg", line 43, in <module>
dispatch.run()
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 113, in run
status = dispatch(req)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 303, in dispatch
ret = _runcatch(req) or 0
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 479, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 488, in _callcatch
return scmutil.callcatch(ui, func)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\scmutil.py", line 152, in callcatch
return func()
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 469, in _runcatchfunc
return _dispatch(req)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 1233, in _dispatch
lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 917, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 1244, in _runcommand
return cmdfunc()
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 1230, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\util.py", line 1867, in check
return func(*args, **kwargs)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\util.py", line 1867, in check
return func(*args, **kwargs)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\hgext\mq.py", line 4226, in mqcommand
return orig(ui, repo, *args, **kwargs)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\util.py", line 1867, in check
return func(*args, **kwargs)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\commands.py", line 6519, in serve
return server.runservice(opts, initfn=service.init, runfn=service.run)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\server.py", line 164, in runservice
return runfn()
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\commandserver.py", line 469, in run
return sv.serve()
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\commandserver.py", line 403, in serve
while self.serveone():
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\commandserver.py", line 377, in serveone
handler(self)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\commandserver.py", line 358, in runcommand
ret = self._dispatchcommand(req) & 255
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\commandserver.py", line 297, in _dispatchcommand
return dispatch.dispatch(req)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 303, in dispatch
ret = _runcatch(req) or 0
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 479, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 488, in _callcatch
return scmutil.callcatch(ui, func)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\scmutil.py", line 152, in callcatch
return func()
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 469, in _runcatchfunc
return _dispatch(req)
File "c:\Users\Matt\projects\thg_py3\tortoisehg\util\hgdispatch.py", line 23, in _dispatch
return orig(req)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 1233, in _dispatch
lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 917, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 1244, in _runcommand
return cmdfunc()
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\dispatch.py", line 1230, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\util.py", line 1867, in check
return func(*args, **kwargs)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\hgext\patchbomb.py", line 967, in email
sendmail = mail.connect(ui, mbox=mbox)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\mail.py", line 228, in connect
return _smtp(ui)
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial_keyring.py", line 772, in _smtp
username = ui.config('smtp', 'username')
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\ui.py", line 610, in config
section, name, default=default, untrusted=untrusted
File "c:\Users\Matt\projects\thg_py3\build\venv-thg-py3.7.1-x64\lib\site-packages\mercurial\ui.py", line 629, in _config
msg %= (section, name)
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str'
cmdserver: process exited unexpectedly with code 1
```
There are a bunch of `ui`, `config`, and `raise error` cases that aren't prefixed with `b''` (or otherwise converted to bytes). I started changing them, but realizes that some of the variables being formatted in with `%s` may be str that need to be converted to bytes, so I stopped since I didn't see any tests that I could run, and didn't want to make things worse.
The `buglink` attribute at the button also needs a `b''` prefix.https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/73an update to various links in the README2021-02-20T18:45:55ZAnton Shestakovan update to various links in the READMEI've updated links to mercurial and thg here: https://code.rhodecode.com/u/av6/wip/mercurial_keyring
Feel free to fold the changesets after reviewing.I've updated links to mercurial and thg here: https://code.rhodecode.com/u/av6/wip/mercurial_keyring
Feel free to fold the changesets after reviewing.https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/72Fails to import on macOS with Mercurial 5.4.22021-02-20T18:35:48ZScott PalmerFails to import on macOS with Mercurial 5.4.2» hg version -v scott@Scotts-MacBook-Pro
*** failed to import extension mercurial_keyring: 'zipimport.zipimporter' object has n...» hg version -v scott@Scotts-MacBook-Pro
*** failed to import extension mercurial_keyring: 'zipimport.zipimporter' object has no attribute 'exec_module'
Mercurial Distributed SCM (version 5.4.2)
...
I made sure to update everything (in Python 2 and 3)
...
Requirement already up-to-date: mercurial_keyring in /Library/Python/2.7/site-packages/mercurial_keyring-1.3.1-py2.7.egg (1.3.1)
...
Requirement already up-to-date: mercurial_keyring in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mercurial_keyring-1.3.1-py3.7.egg (1.3.1)https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/71It's broken2021-03-04T18:42:48Zphp4fanIt's broken```
$ hg pull
pulling from *********************
keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: cannot import name 'backend' from 'cryptography.hazmat.backends.openssl...```
$ hg pull
pulling from *********************
keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: cannot import name 'backend' from 'cryptography.hazmat.backends.openssl.backend' (/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/backend.py)
```https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/70Breaks every time I upgrade Ubuntu2021-02-20T18:52:42Zphp4fanBreaks every time I upgrade UbuntuEvery single time I upgrade Ubuntu (i.e. from a release to another, i.e. 19.10 to 20.04), this extension stops working.
And it's not like mercurial just stops remembering my passwords, it crashes every time I run a command that requires ...Every single time I upgrade Ubuntu (i.e. from a release to another, i.e. 19.10 to 20.04), this extension stops working.
And it's not like mercurial just stops remembering my passwords, it crashes every time I run a command that requires a password (and all other commands nag me with warnings that the extension is broken).
So I usually end up uninstalling it when I'm in a hurry to get work done, and then reinstall it some time later.
It would be nice if this didn't happen. There must be a way.https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/69Error when trying to save password, Cannot import backend2021-03-05T00:20:36ZAndrew WhalanError when trying to save password, Cannot import backendWhen trying to use mercurial keyring I get the following error:
`keyring: keyring backend doesn't seem to work, password was not saved. Error details: cannot import name 'backend' from 'cryptography.hazmat.backends.openssl.backend' (/us...When trying to use mercurial keyring I get the following error:
`keyring: keyring backend doesn't seem to work, password was not saved. Error details: cannot import name 'backend' from 'cryptography.hazmat.backends.openssl.backend' (/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/backend.py)`
However keyring works fine on the commandline:
```
$ keyring set system user
Password for 'user' in 'system':
$ keyring get system user
test
```
And from within python itself:
```
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import keyring
>>> keyring.get_password("system","user")
'test'
```
I've tried both the default installed versions:
keyring==18.0.1
keyrings.alt==3.4.0
mercurial-keyring==1.3.0
And the latest version from this repo, specifying it specifically in .hgrc
I'm not sure what packages I might be missing as following the steps in the README.rst work fine:
```
$ keyring --list-backends
keyrings.alt.file.PlaintextKeyring (priority: 0.5)
keyrings.alt.file.EncryptedKeyring (priority: 0.6)
keyring.backends.SecretService.Keyring (priority: 5)
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.chainer.ChainerBackend (priority: 10)
$ keyring -b keyring.backends.SecretService.Keyring set service user
Password for 'user' in 'service':
$ keyring -b keyring.backends.SecretService.Keyring get service user
test
$ keyring -b keyring.backends.chainer.ChainerBackend get service user
test
```
and I've forced the backend:
```
$ cat ~/.local/share/python_keyring/keyringrc.cfg
[backend]
default-keyring=keyring.backends.SecretService.Keyring
```
What should I do next?https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/68py3 bytes vs str crash on `hg incoming`2021-07-06T10:32:01ZMatt Harbisonpy3 bytes vs str crash on `hg incoming`I'm in WSL with Ubuntu 18.04, py3.6.9, and hg 5.4, but I don't think that matters. Keyring has been complaining about the backend not working, and I really haven't investigating. But HGPLAIN=1 causes a crash:
```
$ HGPLAIN=1 hg in try...I'm in WSL with Ubuntu 18.04, py3.6.9, and hg 5.4, but I don't think that matters. Keyring has been complaining about the backend not working, and I really haven't investigating. But HGPLAIN=1 causes a crash:
```
$ HGPLAIN=1 hg in try
*** failed to import extension mercurial_keyring: unicode 'keyring_check [PATH]' found in cmdtable.keyring_check
*** (use b'' to make it byte string)
Error initializing plugin EntryPoint(name='Windows (alt)', value='keyrings.alt.Windows', group='keyring.backends').
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backend.py", line 203, in _load_plugins
init_func = ep.load()
File "/home/mharbison/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 95, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
from . import file_base
File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint(name='file', value='keyrings.alt.file', group='keyring.backends').
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backend.py", line 203, in _load_plugins
init_func = ep.load()
File "/home/mharbison/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 95, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/keyrings/alt/file.py", line 11, in <module>
from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint(name='pyfs', value='keyrings.alt.pyfs', group='keyring.backends').
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backend.py", line 203, in _load_plugins
init_func = ep.load()
File "/home/mharbison/.local/lib/python3.6/site-packages/importlib_metadata/__init__.py", line 95, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/keyrings/alt/pyfs.py", line 8, in <module>
from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
comparing with https://vcs.attotech.com/hg/users/bgrove/golang/atto360
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.6.9 (default, Apr 18 2020, 01:56:04) [GCC 8.4.0]
** Mercurial Distributed SCM (version 5.4)
** Extensions loaded: extdiff, evolve, topic, phabricator, rebase, absorb, blackbox, strip, show, fix
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 226, in _read_password_from_keyring
password = keyring.get_password(KEYRING_SERVICE, pwdkey)
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/core.py", line 56, in get_password
return _keyring_backend.get_password(service_name, username)
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backends/fail.py", line 25, in get_password
raise NoKeyringError(msg)
keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mharbison/.local/bin/hg", line 43, in <module>
dispatch.run()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 112, in run
status = dispatch(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 298, in dispatch
ret = _runcatch(req) or 0
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 472, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 481, in _callcatch
return scmutil.callcatch(ui, func)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/scmutil.py", line 152, in callcatch
return func()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 462, in _runcatchfunc
return _dispatch(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1226, in _dispatch
lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 910, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1237, in _runcommand
return cmdfunc()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1223, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/util.py", line 1864, in check
return func(*args, **kwargs)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/commands.py", line 4373, in incoming
return hg.incoming(ui, repo, source, opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/hg.py", line 1240, in incoming
return _incoming(display, subreporecurse, ui, repo, source, opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/hg.py", line 1198, in _incoming
ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/bundlerepo.py", line 549, in getremotechanges
tmp = discovery.findcommonincoming(repo, peer, heads=onlyheads, force=force)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/discovery.py", line 67, in findcommonincoming
ancestorsof=ancestorsof,
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/setdiscovery.py", line 374, in findcommonheads
b'known', {b'nodes': [clnode(r) for r in sample],}
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 141, in __exit__
self.close()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 301, in close
self._responsef.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 325, in _readbatchresponse
remoteresult = next(wireresults)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 580, in _submitbatch
rsp = self._callstream(b"batch", cmds=encodebatchcmds(req))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 485, in _callstream
resp = sendrequest(self.ui, self._urlopener, req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 300, in sendrequest
res = opener.open(req)
File "/usr/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.6/urllib/request.py", line 564, in error
result = self._call_chain(*args)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1035, in http_error_401
url, req, headers)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/url.py", line 514, in http_error_auth_reqed
self, auth_header, host, req, headers
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 616, in basic_http_error_auth_reqed
return basic_http_error_auth_reqed.orig(self, authreq, host, req, headers)
File "/usr/lib/python3.6/urllib/request.py", line 988, in http_error_auth_reqed
return self.retry_http_basic_auth(host, req, realm)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/url.py", line 519, in retry_http_basic_auth
realm, urllibcompat.getfullurl(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 607, in find_user_password
return self._pwd_handler.find_auth(self, realm, authuri, req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 424, in find_auth
pwmgr, realm, authuri, skip_caches=after_bad_auth)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 383, in get_credentials
keyring_pwd = password_store.get_http_password(keyring_url, actual_user)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 177, in get_http_password
self._format_http_key(url, username))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 231, in _read_password_from_keyring
err))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1736, in warn
self._writemsg(self._fmsgerr, type=b'warning', *msg, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1220, in _writemsg
_writemsgwith(self._write, dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 2335, in _writemsgwith
write(dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1175, in _write
self._writenobuf(dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1181, in _writenobuf
msg = b''.join(args)
TypeError: sequence item 0: expected a bytes-like object, str found
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 57, in apport_excepthook
from cStringIO import StringIO
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 894, in _find_spec
File "/home/mharbison/.local/lib/python3.6/site-packages/hgdemandimport/demandimportpy3.py", line 102, in find_spec
spec = finder.find_spec(*args, **kwargs)
AttributeError: '_SixMetaPathImporter' object has no attribute 'find_spec'
Original exception was:
Traceback (most recent call last):
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 226, in _read_password_from_keyring
password = keyring.get_password(KEYRING_SERVICE, pwdkey)
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/core.py", line 56, in get_password
return _keyring_backend.get_password(service_name, username)
File "/home/mharbison/.local/lib/python3.6/site-packages/keyring/backends/fail.py", line 25, in get_password
raise NoKeyringError(msg)
keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mharbison/.local/bin/hg", line 43, in <module>
dispatch.run()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 112, in run
status = dispatch(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 298, in dispatch
ret = _runcatch(req) or 0
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 472, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 481, in _callcatch
return scmutil.callcatch(ui, func)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/scmutil.py", line 152, in callcatch
return func()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 462, in _runcatchfunc
return _dispatch(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1226, in _dispatch
lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 910, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1237, in _runcommand
return cmdfunc()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 1223, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/util.py", line 1864, in check
return func(*args, **kwargs)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/commands.py", line 4373, in incoming
return hg.incoming(ui, repo, source, opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/hg.py", line 1240, in incoming
return _incoming(display, subreporecurse, ui, repo, source, opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/hg.py", line 1198, in _incoming
ui, repo, other, revs, opts[b"bundle"], opts[b"force"]
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/bundlerepo.py", line 549, in getremotechanges
tmp = discovery.findcommonincoming(repo, peer, heads=onlyheads, force=force)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/discovery.py", line 67, in findcommonincoming
ancestorsof=ancestorsof,
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/setdiscovery.py", line 374, in findcommonheads
b'known', {b'nodes': [clnode(r) for r in sample],}
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 141, in __exit__
self.close()
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 301, in close
self._responsef.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 325, in _readbatchresponse
remoteresult = next(wireresults)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/wireprotov1peer.py", line 580, in _submitbatch
rsp = self._callstream(b"batch", cmds=encodebatchcmds(req))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 485, in _callstream
resp = sendrequest(self.ui, self._urlopener, req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 300, in sendrequest
res = opener.open(req)
File "/usr/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.6/urllib/request.py", line 564, in error
result = self._call_chain(*args)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1035, in http_error_401
url, req, headers)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/url.py", line 514, in http_error_auth_reqed
self, auth_header, host, req, headers
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 616, in basic_http_error_auth_reqed
return basic_http_error_auth_reqed.orig(self, authreq, host, req, headers)
File "/usr/lib/python3.6/urllib/request.py", line 988, in http_error_auth_reqed
return self.retry_http_basic_auth(host, req, realm)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/url.py", line 519, in retry_http_basic_auth
realm, urllibcompat.getfullurl(req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 607, in find_user_password
return self._pwd_handler.find_auth(self, realm, authuri, req)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 424, in find_auth
pwmgr, realm, authuri, skip_caches=after_bad_auth)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 383, in get_credentials
keyring_pwd = password_store.get_http_password(keyring_url, actual_user)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 177, in get_http_password
self._format_http_key(url, username))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial_keyring.py", line 231, in _read_password_from_keyring
err))
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1736, in warn
self._writemsg(self._fmsgerr, type=b'warning', *msg, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1220, in _writemsg
_writemsgwith(self._write, dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 2335, in _writemsgwith
write(dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1175, in _write
self._writenobuf(dest, *args, **opts)
File "/home/mharbison/.local/lib/python3.6/site-packages/mercurial/ui.py", line 1181, in _writenobuf
msg = b''.join(args)
TypeError: sequence item 0: expected a bytes-like object, str found
$ pip3 freeze | grep keyring
keyring==21.2.1
keyrings.alt==3.0
mercurial-keyring==1.3.0
```https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/67Document how the f*** to reset passwords2020-04-07T07:58:07ZBitbucket ImporterDocument how the f*** to reset passwords*Created originally on Bitbucket by [teo8976 (Teo Tei)](https://bitbucket.org/%7B4d381d15-4c61-4a29-9de3-d1b5a89dbb2a%7D/)*
I use mercurial keyring and I want it to forget a password for a given user/server \(as if I had never accessed...*Created originally on Bitbucket by [teo8976 (Teo Tei)](https://bitbucket.org/%7B4d381d15-4c61-4a29-9de3-d1b5a89dbb2a%7D/)*
I use mercurial keyring and I want it to forget a password for a given user/server \(as if I had never accessed it and never entered the password\) or, if that is not possible, reset everything that the keyring has stored, i.e. wipe everything out. completely reset it so that it will ask all my passwords once as it did at the beginning of time.
This MUST be possible. If it’s not, then you forgot to implement a very basic feature.
If it is, as I suppose, it’s not documented here:
[https://www.mercurial-scm.org/wiki/KeyringExtension](https://www.mercurial-scm.org/wiki/KeyringExtension)
My use case is that I’m having trouble accessing a repository that I’ve migrated to a new server \(though it has the same user and password\) and the server is behaving as if the client is not providing the password at all. It might be an error on the server side but I need to be sure by authenticating normally making 100% sure I’m providing the password. There might be tons of other different legitimate usecases.
A keyring store passwords. Resetting them is a basic function. And a user must be able to easily find how to do that.https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/66Moving out of BitBucket2021-02-20T19:09:28ZBitbucket ImporterMoving out of BitBucket*Created originally on Bitbucket by [Alphare (Raphaël Gomès)](https://bitbucket.org/%7B288ac559-f99f-40e8-920d-fac938a106e2%7D/)*
Hi.
With BitBucket sunsetting Mercurial support, I thought I’d extend an invitation to move this project...*Created originally on Bitbucket by [Alphare (Raphaël Gomès)](https://bitbucket.org/%7B288ac559-f99f-40e8-920d-fac938a106e2%7D/)*
Hi.
With BitBucket sunsetting Mercurial support, I thought I’d extend an invitation to move this project to [Heptapod](http://heptapod.net). We \(Octobus, the people behind Heptapod\), use `mercurial-keyring` extensively and would like to help all Mercurial-related extensions get a new home before the official support ends.
We have a public instance at [dev.heptapod.net](http://dev.heptapod.net) that already hosts many projects. We’ve been using it for months internally and have been starting to open up to other developers/projects. We would provide you with credentials and a way of migrating the current issues over.
Tell me if that sounds like something you would like to do.https://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/65Broken since forever: failed to import extension mercurial_keyring: No module...2020-04-07T07:58:06ZBitbucket ImporterBroken since forever: failed to import extension mercurial_keyring: No module named builtins*Created originally on Bitbucket by [teo8976 (Teo Tei)](https://bitbucket.org/%7B4d381d15-4c61-4a29-9de3-d1b5a89dbb2a%7D/)*
On ubuntu 16.04, which has Mercurial version 3.7.3, I installed mercurial keyring with
```
sudo apt-get inst...*Created originally on Bitbucket by [teo8976 (Teo Tei)](https://bitbucket.org/%7B4d381d15-4c61-4a29-9de3-d1b5a89dbb2a%7D/)*
On ubuntu 16.04, which has Mercurial version 3.7.3, I installed mercurial keyring with
```
sudo apt-get install mercurial-keyring
```
Every time I run any hg command I get this error:
```
failed to import extension mercurial_keyring: No module named builtins
```
and of course the keyring doesn’t workhttps://foss.heptapod.net/mercurial/mercurial_keyring/-/issues/64Compatibility with Python 32020-04-07T07:58:05ZBitbucket ImporterCompatibility with Python 3*Created originally on Bitbucket by [Jan Niklas Hasse](https://bitbucket.org/%7Bcafe42c4-8c63-4556-ae3c-3210bbd5ccc9%7D/)*
See [https://www.mercurial-scm.org/wiki/Python3#Porting\_Extensions\_to\_Python\_3](https://www.mercurial-scm.org...*Created originally on Bitbucket by [Jan Niklas Hasse](https://bitbucket.org/%7Bcafe42c4-8c63-4556-ae3c-3210bbd5ccc9%7D/)*
See [https://www.mercurial-scm.org/wiki/Python3#Porting\_Extensions\_to\_Python\_3](https://www.mercurial-scm.org/wiki/Python3#Porting_Extensions_to_Python_3)