summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/status.py3
-rw-r--r--subcmds/sync.py26
2 files changed, 15 insertions, 14 deletions
diff --git a/subcmds/status.py b/subcmds/status.py
index b47c8736..773f22d4 100644
--- a/subcmds/status.py
+++ b/subcmds/status.py
@@ -26,6 +26,7 @@ import itertools
26import os 26import os
27 27
28from color import Coloring 28from color import Coloring
29import platform_utils
29 30
30class Status(PagedCommand): 31class Status(PagedCommand):
31 common = True 32 common = True
@@ -115,7 +116,7 @@ the following meanings:
115 """find 'dirs' that are present in 'proj_dirs_parents' but not in 'proj_dirs'""" 116 """find 'dirs' that are present in 'proj_dirs_parents' but not in 'proj_dirs'"""
116 status_header = ' --\t' 117 status_header = ' --\t'
117 for item in dirs: 118 for item in dirs:
118 if not os.path.isdir(item): 119 if not platform_utils.isdir(item):
119 outstring.append(''.join([status_header, item])) 120 outstring.append(''.join([status_header, item]))
120 continue 121 continue
121 if item in proj_dirs: 122 if item in proj_dirs:
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)