Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 1244:937ee88da3ef
clone: fall back to pull if we can't lock the source repo
author | mpm@selenic.com |
---|---|
date | Wed, 14 Sep 2005 15:48:34 -0500 |
parents | 4a6efec8b698 |
children | 0ad3f9b27260 |
comparison
equal
deleted
inserted
replaced
1243:9d10f89b75a5 | 1244:937ee88da3ef |
---|---|
619 if not os.path.exists(source): | 619 if not os.path.exists(source): |
620 source = ui.expandpath(source) | 620 source = ui.expandpath(source) |
621 abspath = source | 621 abspath = source |
622 other = hg.repository(ui, source) | 622 other = hg.repository(ui, source) |
623 | 623 |
624 copy = False | |
624 if other.dev() != -1: | 625 if other.dev() != -1: |
625 abspath = os.path.abspath(source) | 626 abspath = os.path.abspath(source) |
626 | 627 copy = True |
627 # we use a lock here because if we race with commit, we can | 628 |
628 # end up with extra data in the cloned revlogs that's not | 629 if copy: |
629 # pointed to by changesets, thus causing verify to fail | 630 try: |
630 l1 = lock.lock(os.path.join(source, ".hg", "lock")) | 631 # we use a lock here because if we race with commit, we |
631 | 632 # can end up with extra data in the cloned revlogs that's |
632 # and here to avoid premature writing to the target | 633 # not pointed to by changesets, thus causing verify to |
634 # fail | |
635 l1 = lock.lock(os.path.join(source, ".hg", "lock")) | |
636 except OSError: | |
637 copy = False | |
638 | |
639 if copy: | |
640 # we lock here to avoid premature writing to the target | |
633 os.mkdir(os.path.join(dest, ".hg")) | 641 os.mkdir(os.path.join(dest, ".hg")) |
634 l2 = lock.lock(os.path.join(dest, ".hg", "lock")) | 642 l2 = lock.lock(os.path.join(dest, ".hg", "lock")) |
635 | 643 |
636 files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i" | 644 files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i" |
637 for f in files.split(): | 645 for f in files.split(): |