equal
deleted
inserted
replaced
5 # This software may be used and distributed according to the terms |
5 # This software may be used and distributed according to the terms |
6 # of the GNU General Public License, incorporated herein by reference. |
6 # of the GNU General Public License, incorporated herein by reference. |
7 |
7 |
8 from demandload import demandload |
8 from demandload import demandload |
9 demandload(globals(), "os re sys signal shutil") |
9 demandload(globals(), "os re sys signal shutil") |
10 demandload(globals(), "fancyopts ui hg util") |
10 demandload(globals(), "fancyopts ui hg util lock") |
11 demandload(globals(), "fnmatch hgweb mdiff random signal time traceback") |
11 demandload(globals(), "fnmatch hgweb mdiff random signal time traceback") |
12 demandload(globals(), "errno socket version struct atexit") |
12 demandload(globals(), "errno socket version struct atexit") |
13 |
13 |
14 class UnknownCommand(Exception): |
14 class UnknownCommand(Exception): |
15 """Exception raised if command is not in the command table.""" |
15 """Exception raised if command is not in the command table.""" |
492 abspath = os.path.abspath(source) |
492 abspath = os.path.abspath(source) |
493 copyfile = (os.stat(dest).st_dev == other.dev() |
493 copyfile = (os.stat(dest).st_dev == other.dev() |
494 and getattr(os, 'link', None) or shutil.copy2) |
494 and getattr(os, 'link', None) or shutil.copy2) |
495 if copyfile is not shutil.copy2: |
495 if copyfile is not shutil.copy2: |
496 ui.note("cloning by hardlink\n") |
496 ui.note("cloning by hardlink\n") |
|
497 # we use a lock here because because we're not nicely ordered |
|
498 l = lock.lock(os.path.join(source, ".hg", "lock")) |
|
499 |
497 util.copytree(os.path.join(source, ".hg"), os.path.join(dest, ".hg"), |
500 util.copytree(os.path.join(source, ".hg"), os.path.join(dest, ".hg"), |
498 copyfile) |
501 copyfile) |
499 try: |
502 try: |
500 os.unlink(os.path.join(dest, ".hg", "dirstate")) |
503 os.unlink(os.path.join(dest, ".hg", "dirstate")) |
501 except OSError: |
504 except OSError: |