Skip to content

Commit cbf6237

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b0c3db8 commit cbf6237

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

contrib/remote-helpers/git-remote-hg

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Then you can clone with:
1010
# git clone hg::/path/to/mercurial/repo/
1111

12-
from mercurial import hg, ui, bookmarks, context, util, encoding, node
12+
from mercurial import hg, ui, bookmarks, context, util, encoding, node, error
1313

1414
import re
1515
import sys
@@ -284,11 +284,17 @@ def get_repo(url, alias):
284284
else:
285285
local_path = os.path.join(dirname, 'clone')
286286
if not os.path.exists(local_path):
287-
peer, dstpeer = hg.clone(myui, {}, url, local_path, update=False, pull=True)
287+
try:
288+
peer, dstpeer = hg.clone(myui, {}, url, local_path, update=True, pull=True)
289+
except:
290+
die('Repository error')
288291
repo = dstpeer.local()
289292
else:
290293
repo = hg.repository(myui, local_path)
291-
peer = hg.peer(myui, {}, url)
294+
try:
295+
peer = hg.peer(myui, {}, url)
296+
except:
297+
die('Repository error')
292298
repo.pull(peer, heads=None, force=True)
293299

294300
return repo

0 commit comments

Comments
 (0)