summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorDavid Pursehouse <dpursehouse@collab.net>2016-12-06 07:51:01 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-12-06 07:51:01 +0000
commitbb9c42cf1d9e43b190b775def2f111b2277b86ef (patch)
tree5977de47f62409481cef2913df338b262dbe963f /project.py
parentb881d227f3c5ab99c04866723cbc06fed4225e78 (diff)
parent8ac0c96537f876127be879d0931ede1545f93d34 (diff)
downloadgit-repo-bb9c42cf1d9e43b190b775def2f111b2277b86ef.tar.gz
Merge "Fix removing broken symlink in reference dir"
Diffstat (limited to 'project.py')
-rw-r--r--project.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/project.py b/project.py
index 633ae073..0d60fc6e 100644
--- a/project.py
+++ b/project.py
@@ -2442,6 +2442,14 @@ class Project(object):
2442 if name in symlink_dirs and not os.path.lexists(src): 2442 if name in symlink_dirs and not os.path.lexists(src):
2443 os.makedirs(src) 2443 os.makedirs(src)
2444 2444
2445 if name in to_symlink:
2446 os.symlink(os.path.relpath(src, os.path.dirname(dst)), dst)
2447 elif copy_all and not os.path.islink(dst):
2448 if os.path.isdir(src):
2449 shutil.copytree(src, dst)
2450 elif os.path.isfile(src):
2451 shutil.copy(src, dst)
2452
2445 # If the source file doesn't exist, ensure the destination 2453 # If the source file doesn't exist, ensure the destination
2446 # file doesn't either. 2454 # file doesn't either.
2447 if name in symlink_files and not os.path.lexists(src): 2455 if name in symlink_files and not os.path.lexists(src):
@@ -2450,13 +2458,6 @@ class Project(object):
2450 except OSError: 2458 except OSError:
2451 pass 2459 pass
2452 2460
2453 if name in to_symlink:
2454 os.symlink(os.path.relpath(src, os.path.dirname(dst)), dst)
2455 elif copy_all and not os.path.islink(dst):
2456 if os.path.isdir(src):
2457 shutil.copytree(src, dst)
2458 elif os.path.isfile(src):
2459 shutil.copy(src, dst)
2460 except OSError as e: 2461 except OSError as e:
2461 if e.errno == errno.EPERM: 2462 if e.errno == errno.EPERM:
2462 raise DownloadError('filesystem must support symlinks') 2463 raise DownloadError('filesystem must support symlinks')