felipec / git

Fork of Junio Hamano's git for users
Other
204 stars 34 forks source link

Unavailable URL results in cryptic error message #30

Closed vedranmiletic closed 11 years ago

vedranmiletic commented 11 years ago

Say I make a typo and instead of

$ git clone hg::http://code.nsnam.org/ns-3-dev ns-3-dev-local-git

I write

$ git clone hg::http://code.nsnam.org/ns-3-devv ns-3-dev-local-git
Cloning into 'ns-3-dev-local-git'...
Traceback (most recent call last):
  File "/home/vedranm/bin/git-remote-hg", line 899, in 
    sys.exit(main(sys.argv))
  File "/home/vedranm/bin/git-remote-hg", line 866, in main
    repo = get_repo(url, alias)
  File "/home/vedranm/bin/git-remote-hg", line 319, in get_repo
    peer, dstpeer = hg.clone(myui, {}, url, local_path, update=True, pull=True)
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 267, in clone
    srcpeer = peer(ui, peeropts, source)
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 121, in peer
    return _peerorrepo(rui, path, create).peer()
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 101, in _peerorrepo
    obj = _peerlookup(path).instance(ui, path, create)
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 237, in instance
    inst._fetchcaps()
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 57, in _fetchcaps
    self.caps = set(self._call('capabilities').split())
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 170, in _call
    fp = self._callstream(cmd, **args)
  File "/usr/lib/python2.7/dist-packages/mercurial/httppeer.py", line 118, in _callstream
    resp = self.urlopener.open(req)
  File "/usr/lib/python2.7/urllib2.py", line 401, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 419, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/dist-packages/mercurial/url.py", line 315, in http_open
    return self.do_open(httpconnection, req)
  File "/usr/lib/python2.7/dist-packages/mercurial/keepalive.py", line 257, in do_open
    raise urllib2.URLError(err)
urllib2.URLError: 
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/vedranm/bin/git-remote-hg", line 894, in bye
    marks.store()
NameError: global name 'marks' is not defined
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/vedranm/bin/git-remote-hg", line 894, in bye
    marks.store()
NameError: global name 'marks' is not defined

Could this error be made a bit nicer?

felipec commented 11 years ago

Fixed:

% git clone hg::http://code.nsnam.org/ns-3-devv ns-3-dev-local-git
Cloning into 'ns-3-dev-local-git'...
ERROR: Repository error