|
9 | 9 | # Then you can clone with:
|
10 | 10 | # git clone hg::/path/to/mercurial/repo/
|
11 | 11 |
|
12 |
| -from mercurial import hg, ui, bookmarks, context, util, encoding, node |
| 12 | +from mercurial import hg, ui, bookmarks, context, util, encoding, node, error |
13 | 13 |
|
14 | 14 | import re
|
15 | 15 | import sys
|
@@ -284,11 +284,17 @@ def get_repo(url, alias):
|
284 | 284 | else:
|
285 | 285 | local_path = os.path.join(dirname, 'clone')
|
286 | 286 | 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') |
288 | 291 | repo = dstpeer.local()
|
289 | 292 | else:
|
290 | 293 | 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') |
292 | 298 | repo.pull(peer, heads=None, force=True)
|
293 | 299 |
|
294 | 300 | return repo
|
|
0 commit comments