mercurial/commands.py
changeset 528 648386fabf9c
parent 527 58790c83ce52
child 532 2e9698a5c92c
equal deleted inserted replaced
527:58790c83ce52 528:648386fabf9c
   270     source = ui.expandpath(source)
   270     source = ui.expandpath(source)
   271 
   271 
   272     success = False
   272     success = False
   273 
   273 
   274     if dest is None:
   274     if dest is None:
   275         dest = os.path.basename(source)
   275         dest = os.path.basename(os.path.normpath(source))
   276         if dest == source:
   276         if dest == source:
   277             ui.warn('abort: source and destination are the same\n')
   277             ui.warn('abort: source and destination are the same\n')
   278             sys.exit(1)
   278             sys.exit(1)
   279 
   279 
   280     os.mkdir(dest)
   280     os.mkdir(dest)
   285             d1 = os.stat(dest).st_dev
   285             d1 = os.stat(dest).st_dev
   286             d2 = os.stat(source).st_dev
   286             d2 = os.stat(source).st_dev
   287             if d1 == d2: link = 1
   287             if d1 == d2: link = 1
   288 
   288 
   289         if link:
   289         if link:
   290             ui.debug("copying by hardlink\n")
   290             ui.note("copying by hardlink\n")
   291             util.system("cp -al '%s'/.hg '%s'/.hg" % (source, dest))
   291             util.system("cp -al '%s'/.hg '%s'/.hg" % (source, dest))
   292             try:
   292             try:
   293                 os.remove(os.path.join(dest, ".hg", "dirstate"))
   293                 os.remove(os.path.join(dest, ".hg", "dirstate"))
   294             except: pass
   294             except: pass
   295 
   295