Mercurial https clone: "abort: error: (...) wrong version number" - mercurial

I have problem with mercurial on OS X 10.9.1
I have a repository on bitbucket with couple files, when I'm trying to clone it I'm getting an error:
mac-mini-jakub:testrepo kubeczek$ hg clone https://kubecz3k#bitbucket.org/kubecz3k/test
abort: error: _ssl.c:507: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
I have installed Mercurial 2.8.2 for MacOS X 10.9 from https://www.mercurial-scm.org/downloads/
I'm pretty sure that on the side of the bitbucket everything is ok, because I have no problem on linux machine.
here is the full traceback:
mac-mini-jakub:testrepo kubeczek$ hg clone https://kubecz3k#bitbucket.org/kubecz3k/test --traceback
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 133, in _runcatch
return _dispatch(req)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 806, in _dispatch
cmdpats, cmdoptions)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 585, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 897, in _runcommand
return checkargs()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 868, in checkargs
return cmdfunc()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 803, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/util.py", line 512, in check
return func(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/commands.py", line 1286, in clone
branch=opts.get('branch'))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/hg.py", line 268, in clone
srcpeer = peer(ui, peeropts, source)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/hg.py", line 122, in peer
return _peerorrepo(rui, path, create).peer()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/hg.py", line 102, in _peerorrepo
obj = _peerlookup(path).instance(ui, path, create)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/httppeer.py", line 238, in instance
inst._fetchcaps()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/httppeer.py", line 57, in _fetchcaps
self.caps = set(self._call('capabilities').split())
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/httppeer.py", line 171, in _call
fp = self._callstream(cmd, **args)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/httppeer.py", line 118, in _callstream
resp = self.urlopener.open(req)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/url.py", line 368, in https_open
return self.do_open(self._makeconnection, req)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/keepalive.py", line 257, in do_open
raise urllib2.URLError(err)
URLError: <urlopen error [Errno 1] _ssl.c:507: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number>
abort: error: _ssl.c:507: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
My Python version is:
mac-mini-jakub:~ kubeczek$ python -V
Python 2.7.6
And SSL:
>>> print _ssl.OPENSSL_VERSION
OpenSSL 0.9.8y 5 Feb 2013
I will appreciate every help, thanks!

You probably have to disable TLS, read this
To do so, add this to ~/.hgrc
[ui]
tls = False
more information about SSL and TLS here

There is another cause. It might not have been your problem, but it should be listed here as well, for the case others encounter this problem:
If you are behind a proxy and your proxy settings are incorrect, this error message appears as well. God knows why...
Example: you have the following config
[http_proxy]
no = localhost,127.0.0.1
host = 1.2.3.4:8080
user = myusername
passwd = oldpassword
The oldpassword might be obsolet (you have forgotten to change it). Then the very same SSL wrong version error appears. It does absolutly make no sense at all (at least to me), but I reproduced this issue with mercurial 3.6.2. Correcting the proxy settings fixes everything.

Not exactly a direct solution but good workaround:
With strong suggestion that the problem lies is ssl I have switched to ssh(https://confluence.atlassian.com/pages/viewpage.action?pageId=270827678) and now everything works. So from a practical point of view for me this problem is solved.

I had this problem for some bitbucket repositories (but not all). I found that, as per the traceback, setting --config ui.clonebundles=false worked.
hg clone --config ui.clonebundles=false https://bitbucket.org/me/myrepo
made the clone much slower mind you.
[edit] -- Although, see my comment on #UniversE's answer above, the actual problem was to do with an atlassian subdomain not being on my squid proxy's whitelist. phew, that was hard to debug.

As one of the question's comments suggested, switching from https to ssh fixed it for me

You have to disable clonebundle from system wide mercurial config file or own config file.
To do, add following lines to /etc/mercurial/hgrc or ~/.hgrc
# system-wide mercurial configuration file
# See hgrc(5) for more information
[ui]
clonebundles = False

Related

Unable to install tortoisehg on Linux RHEL 7.4

I'm a long-time user of tortoisehg own Windows 7, but new to RedHat Linux.
I have python 2.7.5 installed on my Linux RHEL 7.4 virtual machine.
I installed hg (version 4.0-rc) by following these directions:
https://www.mercurial-scm.org/wiki/Download#Linux_.28.rpm.29
(I had to change 'baseurl=https://www.mercurial-scm.org/release/centos$releasever' to 'baseurl=https://www.mercurial-scm.org/release/centos7')
Then I downloaded and installed tortoisehg-4.2.2-1.fc27.noarch.rpm from:
https://kojipkgs.fedoraproject.org//packages/tortoisehg/4.2.2/1.fc27/noarch/tortoisehg-4.2.2-1.fc27.noarch.rpm
And tortoisehg-nautilus-4.2.2-1.fc27.noarch.rpm from:
https://kojipkgs.fedoraproject.org//packages/tortoisehg/4.2.2/1.fc27/noarch/tortoisehg-nautilus-4.2.2-1.fc27.noarch.rpm
hg seems to work, but when I try to start thg, I get the following error:
Traceback (most recent call last):
File "/usr/bin/thg", line 97, in
sys.exit(tortoisehg.hgqt.run.dispatch(argv))
File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line 152, in getattribute
self._load()
File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line 100, in _load
mod = _hgextimport(_import, head, globals, locals, None, level)
File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line 53, in _hgextimport
return importfunc(name, globals, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/tortoisehg/hgqt/run.py", line 400, in
_('repository root directory or symbolic path name')),
File "/usr/lib/python2.7/site-packages/tortoisehg/util/i18n.py", line 76, in agettext
return hglib.fromunicode(u)
File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line 152, in getattribute
self._load()
File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line 100, in _load
mod = _hgextimport(_import, head, globals, locals, None, level)
File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line 53, in _hgextimport
return importfunc(name, globals, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/tortoisehg/util/hglib.py", line 592, in
loadui = uimod.ui.load
AttributeError: type object 'ui' has no attribute 'load'
I have no idea how to proceed. Can anyone tell me what I'm doing wrong?
Thanks to Yuya N. at Unable to install thg on RHEL 7.4 Linux I was able to get thg working.
The problem was the the major.minor versions of hg and and tortoisehg must match.
I uninstalled tortoisehg-4.2.2-1 and installed tortoisehg-4.0.1 and thg now works.

Compress command fails on fresh installation of WireCloud

I cannot set up a basic wirecloud instance anymore. I tried to create a minimum Wirecloud instance like this:
virtualenv venv
source venv/bin/activate
pip install wirecloud
wirecloud-admin startproject prj
cd prj/
python manage.py collectstatic
python manage.py compress --force
Upon the call to compress the static files an error is thrown:
CommandError: An error occurred during rendering /opt/wc/venv/local/lib/python2.7/site-packages/wirecloud/defaulttheme/templates/wirecloud/views/base_plain.html: Error parsing expression at 30:
none if($important, !important)
^
on line 2 of theme/wirecloud.defaulttheme/css/base/z-depth.scss
Traceback:
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/calculator.py", line 167, in parse_expression
ast = getattr(parser, target)()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 110, in goal
expr_lst = self.expr_lst()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 199, in expr_lst
expr_slst = self.expr_slst()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 211, in expr_slst
or_expr = self.or_expr()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 216, in or_expr
and_expr = self.and_expr()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 225, in and_expr
not_expr = self.not_expr()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 236, in not_expr
comparison = self.comparison()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 244, in comparison
a_expr = self.a_expr()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 275, in a_expr
m_expr = self.m_expr()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 290, in m_expr
u_expr = self.u_expr()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 319, in u_expr
atom = self.atom()
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/grammar/expression.py", line 359, in atom
return TernaryOp(expr_lst)
File "/opt/wc/venv/local/lib/python2.7/site-packages/scss/ast.py", line 558, in __init__
raise SyntaxError("if() must have exactly 3 arguments")
SyntaxError: if() must have exactly 3 arguments
What is the problem here? I just set up the most basic Wirecloud instance possible. If I do not compress it the same error gets thrown in the browser. Is the latest release of wirecloud broken? Or is it something else?
What do I need to do to get a running version again? Help would be much appreciated since the docker image seems to not be able to get restarted and configurations like other databases and so on are thus not very easy to set up...
Use the just released version 0.9.2 of WireCloud :)
See this github ticket for more details.
We are also updated the docker images but if you continue have problems using it, please create a Github ticket or create a new question on StackOverflow with the details.
Wirecloud seems to not be ready for pyscss version 1.3.5.
A downgrade via ´pip install -I pyscss==1.3.4` will do the trick.

Mercurial keeps returning Error 400: Bad Request

Anytime I try to do any interaction with the server, Mercurial returns "abort: HTTP Error 400: Bad Request". We are not using any authentication, so that's not an issue. We have three other developers working on the same repo with the same version of mercurial installed (2.2.3). They haven't had any issues, so it makes me think I'm corrupting something in the .hg folder or something. But I really have no clue.
I was able to clone and work from the new directory just fine. However, about 4 hours later, it started happening again in the new directory too. The only things I did in that time period were commit, pull, and push. When I committed a few hours later and tried to pull, that's when I got the error again.
Here is the debug log for incoming (hg --debug --traceback incoming):
using http://myserver/myapp
sending capabilities command
comparing with http://myserver/myapp
query 1; heads
sending batch command
searching for changes
taking initial sample
searching: 2 queries
query 2; still undecided: 208, sample size is: 200
sending known command
Traceback (most recent call last):
File "mercurial\dispatch.pyo", line 88, in _runcatch
File "mercurial\dispatch.pyo", line 740, in _dispatch
File "mercurial\dispatch.pyo", line 514, in runcommand
File "mercurial\dispatch.pyo", line 830, in _runcommand
File "mercurial\dispatch.pyo", line 801, in checkargs
File "mercurial\dispatch.pyo", line 737, in <lambda>
File "mercurial\util.pyo", line 472, in check
File "mercurial\extensions.pyo", line 144, in wrap
File "mercurial\util.pyo", line 472, in check
File "hgext\mq.pyo", line 3528, in mqcommand
File "mercurial\util.pyo", line 472, in check
File "mercurial\commands.pyo", line 3894, in incoming
File "mercurial\hg.pyo", line 513, in incoming
File "mercurial\hg.pyo", line 472, in _incoming
File "mercurial\bundlerepo.pyo", line 342, in getremotechanges
File "mercurial\discovery.pyo", line 45, in findcommonincoming
File "mercurial\setdiscovery.pyo", line 184, in findcommonheads
File "mercurial\wireproto.pyo", line 116, in plain
File "mercurial\wireproto.pyo", line 164, in _submitone
File "mercurial\httppeer.pyo", line 170, in _call
File "mercurial\httppeer.pyo", line 118, in _callstream
File "urllib2.pyo", line 406, in open
File "urllib2.pyo", line 519, in http_response
File "urllib2.pyo", line 444, in error
File "urllib2.pyo", line 378, in _call_chain
File "urllib2.pyo", line 527, in http_error_default
HTTPError: HTTP Error 400: Bad Request
abort: HTTP Error 400: Bad Request
As I said earlier, I can do a clone, but if I try to run incoming, outgoing, pull, or push, I get this error.
I was able to resolve this issue by running
hg rollback
Once I ran that, it uncommitted my files (but kept the changes, so I could see the modified files in hg status). I was then able to run incoming and pull. Then I re-committed my code and pushed it out without any problems.
So something must be getting corrupted when I commit, just not sure why.
I don't know what's the problem in this specific case. But we had a different problem with the same result - incoming and pull commands failed with 400 Bad Request. So here's receipt for how to investigate the failure, in case hg -v --debug doesn't help.
Take Fiddler for capturing and revealing HTTP traffic. Then run mercurial request as following:
hg --config http_proxy.host=127.0.0.1:8888 pull
The config causes redirects of requests through Fiddler, which is listening on port 8888. Then in Fiddler, you may find the red 400 reply and in Inspectors pane to see an entire message, not the code only.
You may look here for details on our problem, investigation and resolution.

Mercurial / TortoiseHg Issues with Jenkins Slave - A specified logon session does not exist

I've got a build that was previously working fine on the Jenkins Master node that I'm now trying to execute on the Jenkins slave.
I'm using the Jenkins Mercurial Plugin and pointing to the TortoiseHg installation directory on the slave machine.
The Mercurial repository that I'm using is secured by a self-signed certificate (hosted in IIS).
Working on the machine locally, I can clone the repository without issues (this is necessary to get TortoiseHg to preserve the user's password).
However, I seem to be running into issues getting this to work when the build is executed by Jenkins.
The specific error that I'm getting is listed below :
Building remotely on <slave> in workspace <workspace>
$ S:\Software\TortoiseHg/hg clone --rev default --noupdate https://<repository> <workspace_on_slave>
warning: <MercurialServerIP> certificate with fingerprint e3:5f:5e:ea:4f:da:ef:a4:0b:4a:bb:00:e8:31:59:de:ce:d0:28:94 not verified (check hostfingerprints or web.cacerts config setting)
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 2.1.2)
** Extensions loaded: mercurial_keyring
Traceback (most recent call last):
File "hg", line 42, in <module>
File "mercurial\dispatch.pyo", line 27, in run
File "mercurial\dispatch.pyo", line 64, in dispatch
File "mercurial\dispatch.pyo", line 87, in _runcatch
File "mercurial\dispatch.pyo", line 685, in _dispatch
File "mercurial\dispatch.pyo", line 467, in runcommand
File "mercurial\dispatch.pyo", line 739, in _runcommand
File "mercurial\dispatch.pyo", line 693, in checkargs
File "mercurial\dispatch.pyo", line 682, in <lambda>
File "mercurial\util.pyo", line 456, in check
File "mercurial\commands.pyo", line 1157, in clone
File "mercurial\hg.pyo", line 250, in clone
File "mercurial\hg.pyo", line 93, in repository
File "mercurial\httprepo.pyo", line 236, in instance
File "mercurial\httprepo.pyo", line 57, in _fetchcaps
File "mercurial\httprepo.pyo", line 169, in _call
File "mercurial\httprepo.pyo", line 117, in _callstream
File "urllib2.pyo", line 397, in open
File "urllib2.pyo", line 510, in http_response
File "urllib2.pyo", line 429, in error
File "urllib2.pyo", line 369, in _call_chain
File "urllib2.pyo", line 864, in http_error_401
File "mercurial\url.pyo", line 429, in http_error_auth_reqed
File "hgext\mercurial_keyring.pyo", line 332, in basic_http_error_auth_reqed
File "urllib2.pyo", line 842, in http_error_auth_reqed
File "urllib2.pyo", line 845, in retry_http_basic_auth
File "hgext\mercurial_keyring.pyo", line 326, in find_user_password
File "hgext\mercurial_keyring.pyo", line 177, in find_auth
File "hgext\mercurial_keyring.pyo", line 60, in get_http_password
File "keyring\core.pyo", line 37, in get_password
File "keyring\backend.pyo", line 560, in get_password
File "keyring\backend.pyo", line 573, in _get_password
pywintypes.error: (1312, 'CredRead', 'A specified logon session does not exist. It may already have been terminated.')
ERROR: Failed to clone https://<repository>
Can anyone offer suggestions on what I can do to get past this?
Non-Polling Solution: (Useful if you're not doing polling of the repository to trigger builds)
The fix to this turns out to be to manually clone the repository on the slave at the workspace location (where it would normally end up).
It seems that once the repository is available on the slave, it's able to get past the 'A specified logon session does not exist. It may already have been terminated.' error.
Polling Solution: (The solution above does not seem to work with the Jenkins polling functionality, so we're left with the solution below).
See How do you specify authentication information for Mercurial as part of Jenkins? (mercurial_keyring)
The only way I was able to figure out how to get the server to remember the password (and work with polling) in my setup was to specify it manually in \mercurial.ini .
NOTE: You may also have to remove the mercurial_keyring line from mercurial.ini. (This disables the keyring extension on the Jenkins server/slave since we're specifying everything manually.)

Problem with Mercurial hg serve command

When using the hg serve command in windows, the server starts correctly, but when somebody tries to do a clone, this error appears.
$ hg serve
listening at http://machineX:8000/ (bound to *:8000)
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 4456)
Traceback (most recent call last):
File "SocketServer.pyc", line 558, in process_request_thread
File "SocketServer.pyc", line 320, in finish_request
File "mercurial\hgweb\server.pyc", line 42, in __init__
File "SocketServer.pyc", line 615, in __init__
File "BaseHTTPServer.pyc", line 329, in handle
File "BaseHTTPServer.pyc", line 323, in handle_one_request
File "mercurial\hgweb\server.pyc", line 74, in do_GET
File "mercurial\hgweb\server.pyc", line 65, in do_POST
File "mercurial\hgweb\server.pyc", line 58, in do_write
File "mercurial\hgweb\server.pyc", line 122, in do_hgweb
File "mercurial\hgweb\hgweb_mod.pyc", line 85, in __call__
File "mercurial\hgweb\hgweb_mod.pyc", line 117, in run_wsgi
ErrorResponse
----------------------------------------
It seems this is some sort of python error... I've already tried reinstalling to the lastest version of mercurial, but still the same problem occurs.
anybody else seen this before?
thanks!
It a dumb problem...
I was doing hg serve on my "hello" repository, and I was trying to access it as
hg clone http://machine:8000/hello
you shouldn't use the repo name in the address...
that is all.