diff options
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 28 |
1 files changed, 12 insertions, 16 deletions
| @@ -145,7 +145,7 @@ def _ProjectHooks(): | |||
| 145 | """ | 145 | """ |
| 146 | global _project_hook_list | 146 | global _project_hook_list |
| 147 | if _project_hook_list is None: | 147 | if _project_hook_list is None: |
| 148 | d = platform_utils.realpath(os.path.abspath(os.path.dirname(__file__))) | 148 | d = os.path.realpath(os.path.abspath(os.path.dirname(__file__))) |
| 149 | d = os.path.join(d, "hooks") | 149 | d = os.path.join(d, "hooks") |
| 150 | _project_hook_list = [ | 150 | _project_hook_list = [ |
| 151 | os.path.join(d, x) for x in platform_utils.listdir(d) | 151 | os.path.join(d, x) for x in platform_utils.listdir(d) |
| @@ -1826,7 +1826,7 @@ class Project: | |||
| 1826 | # remove because it will recursively delete projects -- we handle that | 1826 | # remove because it will recursively delete projects -- we handle that |
| 1827 | # ourselves below. https://crbug.com/git/48 | 1827 | # ourselves below. https://crbug.com/git/48 |
| 1828 | if self.use_git_worktrees: | 1828 | if self.use_git_worktrees: |
| 1829 | needle = platform_utils.realpath(self.gitdir) | 1829 | needle = os.path.realpath(self.gitdir) |
| 1830 | # Find the git worktree commondir under .repo/worktrees/. | 1830 | # Find the git worktree commondir under .repo/worktrees/. |
| 1831 | output = self.bare_git.worktree("list", "--porcelain").splitlines()[ | 1831 | output = self.bare_git.worktree("list", "--porcelain").splitlines()[ |
| 1832 | 0 | 1832 | 0 |
| @@ -1840,7 +1840,7 @@ class Project: | |||
| 1840 | with open(gitdir) as fp: | 1840 | with open(gitdir) as fp: |
| 1841 | relpath = fp.read().strip() | 1841 | relpath = fp.read().strip() |
| 1842 | # Resolve the checkout path and see if it matches this project. | 1842 | # Resolve the checkout path and see if it matches this project. |
| 1843 | fullpath = platform_utils.realpath( | 1843 | fullpath = os.path.realpath( |
| 1844 | os.path.join(configs, name, relpath) | 1844 | os.path.join(configs, name, relpath) |
| 1845 | ) | 1845 | ) |
| 1846 | if fullpath == needle: | 1846 | if fullpath == needle: |
| @@ -2975,14 +2975,12 @@ class Project: | |||
| 2975 | "Retrying clone after deleting %s", self.gitdir | 2975 | "Retrying clone after deleting %s", self.gitdir |
| 2976 | ) | 2976 | ) |
| 2977 | try: | 2977 | try: |
| 2978 | platform_utils.rmtree( | 2978 | platform_utils.rmtree(os.path.realpath(self.gitdir)) |
| 2979 | platform_utils.realpath(self.gitdir) | ||
| 2980 | ) | ||
| 2981 | if self.worktree and os.path.exists( | 2979 | if self.worktree and os.path.exists( |
| 2982 | platform_utils.realpath(self.worktree) | 2980 | os.path.realpath(self.worktree) |
| 2983 | ): | 2981 | ): |
| 2984 | platform_utils.rmtree( | 2982 | platform_utils.rmtree( |
| 2985 | platform_utils.realpath(self.worktree) | 2983 | os.path.realpath(self.worktree) |
| 2986 | ) | 2984 | ) |
| 2987 | return self._InitGitDir( | 2985 | return self._InitGitDir( |
| 2988 | mirror_git=mirror_git, | 2986 | mirror_git=mirror_git, |
| @@ -3068,7 +3066,7 @@ class Project: | |||
| 3068 | self._InitHooks(quiet=quiet) | 3066 | self._InitHooks(quiet=quiet) |
| 3069 | 3067 | ||
| 3070 | def _InitHooks(self, quiet=False): | 3068 | def _InitHooks(self, quiet=False): |
| 3071 | hooks = platform_utils.realpath(os.path.join(self.objdir, "hooks")) | 3069 | hooks = os.path.realpath(os.path.join(self.objdir, "hooks")) |
| 3072 | if not os.path.exists(hooks): | 3070 | if not os.path.exists(hooks): |
| 3073 | os.makedirs(hooks) | 3071 | os.makedirs(hooks) |
| 3074 | 3072 | ||
| @@ -3211,9 +3209,9 @@ class Project: | |||
| 3211 | dst_path = os.path.join(destdir, name) | 3209 | dst_path = os.path.join(destdir, name) |
| 3212 | src_path = os.path.join(srcdir, name) | 3210 | src_path = os.path.join(srcdir, name) |
| 3213 | 3211 | ||
| 3214 | dst = platform_utils.realpath(dst_path) | 3212 | dst = os.path.realpath(dst_path) |
| 3215 | if os.path.lexists(dst): | 3213 | if os.path.lexists(dst): |
| 3216 | src = platform_utils.realpath(src_path) | 3214 | src = os.path.realpath(src_path) |
| 3217 | # Fail if the links are pointing to the wrong place. | 3215 | # Fail if the links are pointing to the wrong place. |
| 3218 | if src != dst: | 3216 | if src != dst: |
| 3219 | logger.error( | 3217 | logger.error( |
| @@ -3249,10 +3247,10 @@ class Project: | |||
| 3249 | if copy_all: | 3247 | if copy_all: |
| 3250 | to_copy = platform_utils.listdir(gitdir) | 3248 | to_copy = platform_utils.listdir(gitdir) |
| 3251 | 3249 | ||
| 3252 | dotgit = platform_utils.realpath(dotgit) | 3250 | dotgit = os.path.realpath(dotgit) |
| 3253 | for name in set(to_copy).union(to_symlink): | 3251 | for name in set(to_copy).union(to_symlink): |
| 3254 | try: | 3252 | try: |
| 3255 | src = platform_utils.realpath(os.path.join(gitdir, name)) | 3253 | src = os.path.realpath(os.path.join(gitdir, name)) |
| 3256 | dst = os.path.join(dotgit, name) | 3254 | dst = os.path.join(dotgit, name) |
| 3257 | 3255 | ||
| 3258 | if os.path.lexists(dst): | 3256 | if os.path.lexists(dst): |
| @@ -3349,9 +3347,7 @@ class Project: | |||
| 3349 | else: | 3347 | else: |
| 3350 | if not init_dotgit: | 3348 | if not init_dotgit: |
| 3351 | # See if the project has changed. | 3349 | # See if the project has changed. |
| 3352 | if platform_utils.realpath( | 3350 | if os.path.realpath(self.gitdir) != os.path.realpath(dotgit): |
| 3353 | self.gitdir | ||
| 3354 | ) != platform_utils.realpath(dotgit): | ||
| 3355 | platform_utils.remove(dotgit) | 3351 | platform_utils.remove(dotgit) |
| 3356 | 3352 | ||
| 3357 | if init_dotgit or not os.path.exists(dotgit): | 3353 | if init_dotgit or not os.path.exists(dotgit): |
