comparison mercurial/commands.py @ 1208:4644df4944ff

Clean up local clone file list We now use an explicit list of files to copy during clone so that we don't copy anything we shouldn't.
author mpm@selenic.com
date Wed, 07 Sep 2005 19:30:23 -0700
parents a7b8812973d9
children 920682a532df
comparison
equal deleted inserted replaced
1207:a7b8812973d9 1208:4644df4944ff
602 abspath = os.path.abspath(source) 602 abspath = os.path.abspath(source)
603 copyfile = (os.stat(dest).st_dev == other.dev() 603 copyfile = (os.stat(dest).st_dev == other.dev()
604 and getattr(os, 'link', None) or shutil.copy2) 604 and getattr(os, 'link', None) or shutil.copy2)
605 if copyfile is not shutil.copy2: 605 if copyfile is not shutil.copy2:
606 ui.note("cloning by hardlink\n") 606 ui.note("cloning by hardlink\n")
607
607 # we use a lock here because because we're not nicely ordered 608 # we use a lock here because because we're not nicely ordered
608 l = lock.lock(os.path.join(source, ".hg", "lock")) 609 l = lock.lock(os.path.join(source, ".hg", "lock"))
609 610
610 util.copyfiles(os.path.join(source, ".hg"), os.path.join(dest, ".hg"), 611 os.mkdir(os.path.join(dest, ".hg"))
611 copyfile) 612
612 613 files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i"
613 for fn in "dirstate", "lock", "hgrc", "localtags": 614 for f in files.split():
614 try: 615 src = os.path.join(source, ".hg", f)
615 os.unlink(os.path.join(dest, ".hg", fn)) 616 dst = os.path.join(dest, ".hg", f)
616 except OSError: 617 util.copyfiles(src, dst, copyfile)
617 pass
618 618
619 repo = hg.repository(ui, dest) 619 repo = hg.repository(ui, dest)
620 620
621 else: 621 else:
622 repo = hg.repository(ui, dest, create=1) 622 repo = hg.repository(ui, dest, create=1)