comparison mercurial/util.py @ 14909:c627fe32c923

util: move "default" unlinkpath to posix.py we have a unlinkpath in windows.py
author Adrian Buehlmann <adrian@cadifra.com>
date Fri, 22 Jul 2011 09:55:46 +0200
parents e2b5605501df
children 570ea0259b0a
comparison
equal deleted inserted replaced
14908:e2b5605501df 14909:c627fe32c923
388 raise error.SignatureError 388 raise error.SignatureError
389 raise 389 raise
390 390
391 return check 391 return check
392 392
393 def unlinkpath(f):
394 """unlink and remove the directory if it is empty"""
395 os.unlink(f)
396 # try removing directories that might now be empty
397 try:
398 os.removedirs(os.path.dirname(f))
399 except OSError:
400 pass
401
402 def copyfile(src, dest): 393 def copyfile(src, dest):
403 "copy a file, preserving mode and atime/mtime" 394 "copy a file, preserving mode and atime/mtime"
404 if os.path.islink(src): 395 if os.path.islink(src):
405 try: 396 try:
406 os.unlink(dest) 397 os.unlink(dest)