Opened 13 years ago

Closed 13 years ago

#30199 closed defect (fixed)

Mercurial 1.9 broken, cannot import readauthforuri

Reported by: m@… Owned by: deric@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc: pixilla (Bradley Giesbrecht)
Port: mercurial

Description

I upgraded to Mercurial 1.9, unfortunately pull and push does not work anymore:

$ hg pull
abort: cannot import name readauthforuri!

Change History (8)

comment:1 Changed 13 years ago by m@…

Maybe related to py26-mercurial_keyring?

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/dispatch.py", line 87, in _runcatch
    return _dispatch(req)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/dispatch.py", line 675, in _dispatch
    cmdpats, cmdoptions)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/dispatch.py", line 454, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/dispatch.py", line 729, in _runcommand
    return checkargs()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/dispatch.py", line 683, in checkargs
    return cmdfunc()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/dispatch.py", line 672, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/util.py", line 385, in check
    return func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/extensions.py", line 137, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/util.py", line 385, in check
    return func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/hgext/rebase.py", line 577, in pullrebase
    orig(ui, repo, *args, **opts)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/util.py", line 385, in check
    return func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/extensions.py", line 137, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/util.py", line 385, in check
    return func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/hgext/mq.py", line 3218, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/util.py", line 385, in check
    return func(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/commands.py", line 3772, in pull
    other = hg.peer(repo, opts, source)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/hg.py", line 104, in peer
    return repository(rui, path, create)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/hg.py", line 93, in repository
    repo = _peerlookup(path).instance(ui, path, create)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/httprepo.py", line 230, in instance
    inst._fetchcaps()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/httprepo.py", line 56, in _fetchcaps
    self.caps = set(self._call('capabilities').split())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/httprepo.py", line 163, in _call
    fp = self._callstream(cmd, **args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/httprepo.py", line 113, in _callstream
    resp = self.urlopener.open(req)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 397, in open
    response = meth(req, response)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 429, in error
    result = self._call_chain(*args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 875, in http_error_401
    url, req, headers)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial/url.py", line 419, in http_error_auth_reqed
    self, auth_header, host, req, headers)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 853, in http_error_auth_reqed
    return self.retry_http_basic_auth(host, req, realm)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 856, in retry_http_basic_auth
    user, pw = self.passwd.find_user_password(realm, host)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial_keyring.py", line 294, in find_user_password
    return self._pwd_handler.find_auth(self, realm, authuri)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial_keyring.py", line 123, in find_auth
    auth_user, pwd, prefix_url = self.load_hgrc_auth(ui, base_url)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mercurial_keyring.py", line 237, in load_hgrc_auth
    from mercurial.url import readauthforuri
ImportError: cannot import name readauthforuri
abort: cannot import name readauthforuri!

comment:2 Changed 13 years ago by m@…

Macports installs mercurial_keyring version 0.4.4, version 0.4.5 contains the following fix:

# HG changeset patch -- Bitbucket.org
# Project mercurial_keyring
# URL https://bitbucket.org/Mekk/mercurial_keyring/overview
# User Steve Borho <steve@borho.org>
# Date 1304917199 18000
# Node ID a6e455012d1406f694365155941aa7dc3dad5d11
# Parent  04cd5a463bf754f5ee2d73d2238fa2c42038e7ce
readauthforuri has been moved into new httpconnection module

--- a/mercurial_keyring.py
+++ b/mercurial_keyring.py
@@ -233,8 +233,12 @@ class HTTPPasswordHandler(object):
             local_passwordmgr = passwordmgr(local_ui)
             auth_token = local_passwordmgr.readauthtoken(base_url)
         except AttributeError:
-            # hg 1.8
-            from mercurial.url import readauthforuri
+            try:
+                # hg 1.8
+                from mercurial.url import readauthforuri
+            except ImportError:
+                # hg 1.9
+                from mercurial.httpconnection import readauthforuri
             res = readauthforuri(local_ui, base_url)
             if res:
                 group, auth_token = res

I think the outdated keyring extension is the culprit...

comment:3 Changed 13 years ago by m@…

I created Ticket #30200 which refers to the correct port for this issue.

comment:4 Changed 13 years ago by jmroot (Joshua Root)

Keywords: mercurial push pull import readauthforuri removed
Owner: changed from macports-tickets@… to deric@…
Port: @1.9 (devel python) removed

comment:5 Changed 13 years ago by pixilla (Bradley Giesbrecht)

Cc: pixilla@… added

Cc Me!

comment:6 Changed 13 years ago by anddam (Andrea D'Amore)

Please check #30200 and confirm this ticket is fixed.

comment:7 Changed 13 years ago by m@…

Works now as expected. Thanks!

comment:8 Changed 13 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.