|
38 | 38 |
|
39 | 39 | from mercurial.ui import ui
|
40 | 40 | from mercurial.context import memctx, memfilectx
|
41 |
| -from mercurial.error import Abort |
| 41 | +from mercurial.error import Abort, RepoError |
42 | 42 | from mercurial import encoding
|
43 | 43 | from mercurial.bookmarks import listbookmarks, readcurrent, pushbookmark
|
44 | 44 | from mercurial.util import sha1
|
@@ -311,8 +311,15 @@ def build_repo(self, url):
|
311 | 311 |
|
312 | 312 | local_path = self.remotedir.joinpath('clone')
|
313 | 313 | if not local_path.exists():
|
314 |
| - self.peer, dstpeer = hg.clone(myui, {}, url.encode('utf-8'), |
315 |
| - local_path.encode('utf-8'), update=False, pull=True) |
| 314 | + try: |
| 315 | + self.peer, dstpeer = hg.clone(myui, {}, url.encode('utf-8'), |
| 316 | + local_path.encode('utf-8'), update=False, pull=True) |
| 317 | + except (RepoError, Abort) as e: |
| 318 | + sys.stderr.write("abort: %s\n" % e) |
| 319 | + if e.hint: |
| 320 | + sys.stderr.write("(%s)\n" % e.hint) |
| 321 | + sys.exit(-1) |
| 322 | + |
316 | 323 | self.repo = dstpeer.local()
|
317 | 324 | else:
|
318 | 325 | self.repo = hg.repository(myui, local_path.encode('utf-8'))
|
|
0 commit comments