Mercurial > gcp
comparison gcp @ 46:dda2195dc9f4
Symbolic link skipping
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 04 Jun 2011 20:55:44 +0200 |
parents | 97384a79043d |
children | 99da6ef26d26 |
comparison
equal
deleted
inserted
replaced
45:97384a79043d | 46:dda2195dc9f4 |
---|---|
264 #TODO: check that dest_path is an accessible dir, | 264 #TODO: check that dest_path is an accessible dir, |
265 # and skip file/write error in log if needed | 265 # and skip file/write error in log if needed |
266 try: | 266 try: |
267 for filename in os.listdir(dirpath): | 267 for filename in os.listdir(dirpath): |
268 filepath = os.path.join(dirpath,filename) | 268 filepath = os.path.join(dirpath,filename) |
269 if os.path.islink(filepath) and not options.dereference: | |
270 debug ("Skippink symbolic dir: %s" % filepath.decode('utf-8','replace')) | |
271 continue | |
269 if os.path.isdir(filepath): | 272 if os.path.isdir(filepath): |
270 full_dest_path = os.path.join(dest_path,filename) | 273 full_dest_path = os.path.join(dest_path,filename) |
271 self.__appendDirToList(filepath, full_dest_path, options) | 274 self.__appendDirToList(filepath, full_dest_path, options) |
272 else: | 275 else: |
273 self.__appendToList(filepath, dest_path, options) | 276 self.__appendToList(filepath, dest_path, options) |
548 help=_("force overwriting of existing files")) | 551 help=_("force overwriting of existing files")) |
549 | 552 |
550 parser.add_option("--preserve", action="store", default='mode,ownership,timestamps', | 553 parser.add_option("--preserve", action="store", default='mode,ownership,timestamps', |
551 help=_("preserve the specified attributes")) | 554 help=_("preserve the specified attributes")) |
552 | 555 |
556 parser.add_option("-L", "--dereference", action="store_true", default=False, | |
557 help=_("always follow symbolic links in sources")) | |
558 | |
559 parser.add_option("-P", "--no-dereference", action="store_false", dest='dereference', | |
560 help=_("never follow symbolic links in sources")) | |
561 | |
553 #parser.add_option("--no-unicode-fix", action="store_false", dest='unicode_fix', default=True, | 562 #parser.add_option("--no-unicode-fix", action="store_false", dest='unicode_fix', default=True, |
554 # help=_("don't fix name encoding errors")) #TODO | 563 # help=_("don't fix name encoding errors")) #TODO |
555 | 564 |
556 parser.add_option("--no-fs-fix", action="store_false", dest='fs_fix', default=True, | 565 parser.add_option("--no-fs-fix", action="store_false", dest='fs_fix', default=True, |
557 help=_("don't fix filesystem name incompatibily")) | 566 help=_("don't fix filesystem name incompatibily")) |