855 except error.LockError: |
855 except error.LockError: |
856 copy = False |
856 copy = False |
857 |
857 |
858 if copy: |
858 if copy: |
859 srcrepo.hook(b'preoutgoing', throw=True, source=b'clone') |
859 srcrepo.hook(b'preoutgoing', throw=True, source=b'clone') |
860 hgdir = os.path.realpath(os.path.join(dest, b".hg")) |
860 |
861 if not os.path.exists(dest): |
861 destrootpath = urlutil.urllocalpath(dest) |
862 util.makedirs(dest) |
862 dest_reqs = localrepo.clone_requirements(ui, createopts, srcrepo) |
863 try: |
863 localrepo.createrepository( |
864 destpath = hgdir |
864 ui, |
865 util.makedir(destpath, notindexed=True) |
865 destrootpath, |
866 except OSError as inst: |
866 requirements=dest_reqs, |
867 if inst.errno == errno.EEXIST: |
867 ) |
868 cleandir = None |
868 destrepo = localrepo.makelocalrepository(ui, destrootpath) |
869 raise error.Abort( |
869 |
870 _(b"destination '%s' already exists") % dest |
870 destpath = destrepo.vfs.base |
871 ) |
|
872 raise |
|
873 |
|
874 destlock = copystore(ui, srcrepo, destpath) |
871 destlock = copystore(ui, srcrepo, destpath) |
875 # copy bookmarks over |
872 # copy bookmarks over |
876 srcbookmarks = srcrepo.vfs.join(b'bookmarks') |
873 srcbookmarks = srcrepo.vfs.join(b'bookmarks') |
877 dstbookmarks = os.path.join(destpath, b'bookmarks') |
874 dstbookmarks = os.path.join(destpath, b'bookmarks') |
878 if os.path.exists(srcbookmarks): |
875 if os.path.exists(srcbookmarks): |