Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 28324:549ff28a345f
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 02 Mar 2016 16:44:56 -0600 |
parents | a4692267bc2d d493d64757eb |
children | 66513f6ca038 |
comparison
equal
deleted
inserted
replaced
28323:ffc693f87148 | 28324:549ff28a345f |
---|---|
341 raise error.Abort(_("src repository does not support " | 341 raise error.Abort(_("src repository does not support " |
342 "revision lookup and so doesn't " | 342 "revision lookup and so doesn't " |
343 "support clone by revision")) | 343 "support clone by revision")) |
344 revs = [srcpeer.lookup(r) for r in rev] | 344 revs = [srcpeer.lookup(r) for r in rev] |
345 | 345 |
346 # Obtain a lock before checking for or cloning the pooled repo otherwise | |
347 # 2 clients may race creating or populating it. | |
348 pooldir = os.path.dirname(sharepath) | |
349 # lock class requires the directory to exist. | |
350 try: | |
351 util.makedir(pooldir, False) | |
352 except OSError as e: | |
353 if e.errno != errno.EEXIST: | |
354 raise | |
355 | |
356 poolvfs = scmutil.vfs(pooldir) | |
346 basename = os.path.basename(sharepath) | 357 basename = os.path.basename(sharepath) |
347 | 358 |
348 if os.path.exists(sharepath): | 359 with lock.lock(poolvfs, '%s.lock' % basename): |
349 ui.status(_('(sharing from existing pooled repository %s)\n') % | 360 if os.path.exists(sharepath): |
350 basename) | 361 ui.status(_('(sharing from existing pooled repository %s)\n') % |
351 else: | 362 basename) |
352 ui.status(_('(sharing from new pooled repository %s)\n') % basename) | 363 else: |
353 # Always use pull mode because hardlinks in share mode don't work well. | 364 ui.status(_('(sharing from new pooled repository %s)\n') % basename) |
354 # Never update because working copies aren't necessary in share mode. | 365 # Always use pull mode because hardlinks in share mode don't work |
355 clone(ui, peeropts, source, dest=sharepath, pull=True, | 366 # well. Never update because working copies aren't necessary in |
356 rev=rev, update=False, stream=stream) | 367 # share mode. |
368 clone(ui, peeropts, source, dest=sharepath, pull=True, | |
369 rev=rev, update=False, stream=stream) | |
357 | 370 |
358 sharerepo = repository(ui, path=sharepath) | 371 sharerepo = repository(ui, path=sharepath) |
359 share(ui, sharerepo, dest=dest, update=False, bookmarks=False) | 372 share(ui, sharerepo, dest=dest, update=False, bookmarks=False) |
360 | 373 |
361 # We need to perform a pull against the dest repo to fetch bookmarks | 374 # We need to perform a pull against the dest repo to fetch bookmarks |