diff options
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -1706,6 +1706,7 @@ class Project(object): | |||
1706 | if command.Wait() != 0: | 1706 | if command.Wait() != 0: |
1707 | raise GitError('git archive %s: %s' % (self.name, command.stderr)) | 1707 | raise GitError('git archive %s: %s' % (self.name, command.stderr)) |
1708 | 1708 | ||
1709 | |||
1709 | def _RemoteFetch(self, name=None, | 1710 | def _RemoteFetch(self, name=None, |
1710 | current_branch_only=False, | 1711 | current_branch_only=False, |
1711 | initial=False, | 1712 | initial=False, |
@@ -1808,19 +1809,30 @@ class Project(object): | |||
1808 | else: | 1809 | else: |
1809 | cmd.append('--tags') | 1810 | cmd.append('--tags') |
1810 | 1811 | ||
1812 | spec = [] | ||
1811 | if not current_branch_only: | 1813 | if not current_branch_only: |
1812 | # Fetch whole repo | 1814 | # Fetch whole repo |
1813 | cmd.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) | 1815 | spec.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) |
1814 | elif tag_name is not None: | 1816 | elif tag_name is not None: |
1815 | cmd.append('tag') | 1817 | spec.append('tag') |
1816 | cmd.append(tag_name) | 1818 | spec.append(tag_name) |
1817 | else: | 1819 | else: |
1818 | branch = self.revisionExpr | 1820 | branch = self.revisionExpr |
1819 | if is_sha1: | 1821 | if is_sha1: |
1820 | branch = self.upstream | 1822 | branch = self.upstream |
1821 | if branch.startswith(R_HEADS): | 1823 | if branch.startswith(R_HEADS): |
1822 | branch = branch[len(R_HEADS):] | 1824 | branch = branch[len(R_HEADS):] |
1823 | cmd.append(str((u'+refs/heads/%s:' % branch) + remote.ToLocal('refs/heads/%s' % branch))) | 1825 | spec.append(str((u'+refs/heads/%s:' % branch) + remote.ToLocal('refs/heads/%s' % branch))) |
1826 | cmd.extend(spec) | ||
1827 | |||
1828 | shallowfetch = self.config.GetString('repo.shallowfetch') | ||
1829 | if shallowfetch and shallowfetch != ' '.join(spec): | ||
1830 | GitCommand(self, ['fetch', '--unshallow', name] + shallowfetch.split(), | ||
1831 | bare=True, ssh_proxy=ssh_proxy).Wait() | ||
1832 | if depth: | ||
1833 | self.config.SetString('repo.shallowfetch', ' '.join(spec)) | ||
1834 | else: | ||
1835 | self.config.SetString('repo.shallowfetch', None) | ||
1824 | 1836 | ||
1825 | ok = False | 1837 | ok = False |
1826 | for _i in range(2): | 1838 | for _i in range(2): |
@@ -2205,6 +2217,14 @@ class Project(object): | |||
2205 | if name in symlink_dirs and not os.path.lexists(src): | 2217 | if name in symlink_dirs and not os.path.lexists(src): |
2206 | os.makedirs(src) | 2218 | os.makedirs(src) |
2207 | 2219 | ||
2220 | # If the source file doesn't exist, ensure the destination | ||
2221 | # file doesn't either. | ||
2222 | if name in symlink_files and not os.path.lexists(src): | ||
2223 | try: | ||
2224 | os.remove(dst) | ||
2225 | except OSError: | ||
2226 | pass | ||
2227 | |||
2208 | if name in to_symlink: | 2228 | if name in to_symlink: |
2209 | os.symlink(os.path.relpath(src, os.path.dirname(dst)), dst) | 2229 | os.symlink(os.path.relpath(src, os.path.dirname(dst)), dst) |
2210 | elif copy_all and not os.path.islink(dst): | 2230 | elif copy_all and not os.path.islink(dst): |