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(): |