diff options
Diffstat (limited to 'subcmds/sync.py')
| -rw-r--r-- | subcmds/sync.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 943a0264..f6bd983d 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -474,8 +474,8 @@ later is required to fix a server side protocol bug. | |||
| 474 | # so rmtree works. | 474 | # so rmtree works. |
| 475 | try: | 475 | try: |
| 476 | platform_utils.rmtree(os.path.join(path, '.git')) | 476 | platform_utils.rmtree(os.path.join(path, '.git')) |
| 477 | except OSError: | 477 | except OSError as e: |
| 478 | print('Failed to remove %s' % os.path.join(path, '.git'), file=sys.stderr) | 478 | print('Failed to remove %s (%s)' % (os.path.join(path, '.git'), str(e)), file=sys.stderr) |
| 479 | print('error: Failed to delete obsolete path %s' % path, file=sys.stderr) | 479 | print('error: Failed to delete obsolete path %s' % path, file=sys.stderr) |
| 480 | print(' remove manually, then run sync again', file=sys.stderr) | 480 | print(' remove manually, then run sync again', file=sys.stderr) |
| 481 | return -1 | 481 | return -1 |
| @@ -484,12 +484,12 @@ later is required to fix a server side protocol bug. | |||
| 484 | # another git project | 484 | # another git project |
| 485 | dirs_to_remove = [] | 485 | dirs_to_remove = [] |
| 486 | failed = False | 486 | failed = False |
| 487 | for root, dirs, files in os.walk(path): | 487 | for root, dirs, files in platform_utils.walk(path): |
| 488 | for f in files: | 488 | for f in files: |
| 489 | try: | 489 | try: |
| 490 | platform_utils.remove(os.path.join(root, f)) | 490 | platform_utils.remove(os.path.join(root, f)) |
| 491 | except OSError: | 491 | except OSError as e: |
| 492 | print('Failed to remove %s' % os.path.join(root, f), file=sys.stderr) | 492 | print('Failed to remove %s (%s)' % (os.path.join(root, f), str(e)), file=sys.stderr) |
| 493 | failed = True | 493 | failed = True |
| 494 | dirs[:] = [d for d in dirs | 494 | dirs[:] = [d for d in dirs |
| 495 | if not os.path.lexists(os.path.join(root, d, '.git'))] | 495 | if not os.path.lexists(os.path.join(root, d, '.git'))] |
| @@ -499,14 +499,14 @@ later is required to fix a server side protocol bug. | |||
| 499 | if platform_utils.islink(d): | 499 | if platform_utils.islink(d): |
| 500 | try: | 500 | try: |
| 501 | platform_utils.remove(d) | 501 | platform_utils.remove(d) |
| 502 | except OSError: | 502 | except OSError as e: |
| 503 | print('Failed to remove %s' % os.path.join(root, d), file=sys.stderr) | 503 | print('Failed to remove %s (%s)' % (os.path.join(root, d), str(e)), file=sys.stderr) |
| 504 | failed = True | 504 | failed = True |
| 505 | elif len(os.listdir(d)) == 0: | 505 | elif len(platform_utils.listdir(d)) == 0: |
| 506 | try: | 506 | try: |
| 507 | os.rmdir(d) | 507 | platform_utils.rmdir(d) |
| 508 | except OSError: | 508 | except OSError as e: |
| 509 | print('Failed to remove %s' % os.path.join(root, d), file=sys.stderr) | 509 | print('Failed to remove %s (%s)' % (os.path.join(root, d), str(e)), file=sys.stderr) |
| 510 | failed = True | 510 | failed = True |
| 511 | continue | 511 | continue |
| 512 | if failed: | 512 | if failed: |
| @@ -517,8 +517,8 @@ later is required to fix a server side protocol bug. | |||
| 517 | # Try deleting parent dirs if they are empty | 517 | # Try deleting parent dirs if they are empty |
| 518 | project_dir = path | 518 | project_dir = path |
| 519 | while project_dir != self.manifest.topdir: | 519 | while project_dir != self.manifest.topdir: |
| 520 | if len(os.listdir(project_dir)) == 0: | 520 | if len(platform_utils.listdir(project_dir)) == 0: |
| 521 | os.rmdir(project_dir) | 521 | platform_utils.rmdir(project_dir) |
| 522 | else: | 522 | else: |
| 523 | break | 523 | break |
| 524 | project_dir = os.path.dirname(project_dir) | 524 | project_dir = os.path.dirname(project_dir) |
