remote-hg: show more proper errors
When cloning or pushing fails, we don't want to show a stack-trace. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b0c3db860c
commit
cbf6237c2b
@ -9,7 +9,7 @@
|
|||||||
# Then you can clone with:
|
# Then you can clone with:
|
||||||
# git clone hg::/path/to/mercurial/repo/
|
# git clone hg::/path/to/mercurial/repo/
|
||||||
|
|
||||||
from mercurial import hg, ui, bookmarks, context, util, encoding, node
|
from mercurial import hg, ui, bookmarks, context, util, encoding, node, error
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@ -284,11 +284,17 @@ def get_repo(url, alias):
|
|||||||
else:
|
else:
|
||||||
local_path = os.path.join(dirname, 'clone')
|
local_path = os.path.join(dirname, 'clone')
|
||||||
if not os.path.exists(local_path):
|
if not os.path.exists(local_path):
|
||||||
peer, dstpeer = hg.clone(myui, {}, url, local_path, update=False, pull=True)
|
try:
|
||||||
|
peer, dstpeer = hg.clone(myui, {}, url, local_path, update=True, pull=True)
|
||||||
|
except:
|
||||||
|
die('Repository error')
|
||||||
repo = dstpeer.local()
|
repo = dstpeer.local()
|
||||||
else:
|
else:
|
||||||
repo = hg.repository(myui, local_path)
|
repo = hg.repository(myui, local_path)
|
||||||
peer = hg.peer(myui, {}, url)
|
try:
|
||||||
|
peer = hg.peer(myui, {}, url)
|
||||||
|
except:
|
||||||
|
die('Repository error')
|
||||||
repo.pull(peer, heads=None, force=True)
|
repo.pull(peer, heads=None, force=True)
|
||||||
|
|
||||||
return repo
|
return repo
|
||||||
|
Loading…
Reference in New Issue
Block a user