Skip to content

Commit

Permalink
remote-hg: show more proper errors
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed Apr 11, 2013
1 parent b0c3db8 commit cbf6237
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions contrib/remote-helpers/git-remote-hg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Then you can clone with:
# 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 sys
Expand Down Expand Up @@ -284,11 +284,17 @@ def get_repo(url, alias):
else:
local_path = os.path.join(dirname, 'clone')
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()
else:
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)

return repo
Expand Down

0 comments on commit cbf6237

Please sign in to comment.