diff options
| -rw-r--r-- | git_command.py | 3 | ||||
| -rw-r--r-- | project.py | 13 | ||||
| -rw-r--r-- | subcmds/init.py | 4 | ||||
| -rw-r--r-- | subcmds/rebase.py | 9 | ||||
| -rw-r--r-- | subcmds/sync.py | 11 |
5 files changed, 32 insertions, 8 deletions
diff --git a/git_command.py b/git_command.py index 0893bff7..63b7b6f2 100644 --- a/git_command.py +++ b/git_command.py | |||
| @@ -168,6 +168,9 @@ class GitCommand(object): | |||
| 168 | if p is not None: | 168 | if p is not None: |
| 169 | s = p + ' ' + s | 169 | s = p + ' ' + s |
| 170 | _setenv(env, 'GIT_CONFIG_PARAMETERS', s) | 170 | _setenv(env, 'GIT_CONFIG_PARAMETERS', s) |
| 171 | if 'GIT_ALLOW_PROTOCOL' not in env: | ||
| 172 | _setenv(env, 'GIT_ALLOW_PROTOCOL', | ||
| 173 | 'file:git:http:https:ssh:persistent-http:persistent-https:sso') | ||
| 171 | 174 | ||
| 172 | if project: | 175 | if project: |
| 173 | if not cwd: | 176 | if not cwd: |
| @@ -249,7 +249,7 @@ class _LinkFile(object): | |||
| 249 | if not os.path.islink(absDest) or (os.readlink(absDest) != relSrc): | 249 | if not os.path.islink(absDest) or (os.readlink(absDest) != relSrc): |
| 250 | try: | 250 | try: |
| 251 | # remove existing file first, since it might be read-only | 251 | # remove existing file first, since it might be read-only |
| 252 | if os.path.exists(absDest): | 252 | if os.path.lexists(absDest): |
| 253 | os.remove(absDest) | 253 | os.remove(absDest) |
| 254 | else: | 254 | else: |
| 255 | dest_dir = os.path.dirname(absDest) | 255 | dest_dir = os.path.dirname(absDest) |
| @@ -1110,7 +1110,8 @@ class Project(object): | |||
| 1110 | clone_bundle=True, | 1110 | clone_bundle=True, |
| 1111 | no_tags=False, | 1111 | no_tags=False, |
| 1112 | archive=False, | 1112 | archive=False, |
| 1113 | optimized_fetch=False): | 1113 | optimized_fetch=False, |
| 1114 | prune=False): | ||
| 1114 | """Perform only the network IO portion of the sync process. | 1115 | """Perform only the network IO portion of the sync process. |
| 1115 | Local working directory/branch state is not affected. | 1116 | Local working directory/branch state is not affected. |
| 1116 | """ | 1117 | """ |
| @@ -1181,7 +1182,7 @@ class Project(object): | |||
| 1181 | if (need_to_fetch | 1182 | if (need_to_fetch |
| 1182 | and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, | 1183 | and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, |
| 1183 | current_branch_only=current_branch_only, | 1184 | current_branch_only=current_branch_only, |
| 1184 | no_tags=no_tags)): | 1185 | no_tags=no_tags, prune=prune)): |
| 1185 | return False | 1186 | return False |
| 1186 | 1187 | ||
| 1187 | if self.worktree: | 1188 | if self.worktree: |
| @@ -1795,7 +1796,8 @@ class Project(object): | |||
| 1795 | initial=False, | 1796 | initial=False, |
| 1796 | quiet=False, | 1797 | quiet=False, |
| 1797 | alt_dir=None, | 1798 | alt_dir=None, |
| 1798 | no_tags=False): | 1799 | no_tags=False, |
| 1800 | prune=False): | ||
| 1799 | 1801 | ||
| 1800 | is_sha1 = False | 1802 | is_sha1 = False |
| 1801 | tag_name = None | 1803 | tag_name = None |
| @@ -1908,6 +1910,9 @@ class Project(object): | |||
| 1908 | else: | 1910 | else: |
| 1909 | cmd.append('--tags') | 1911 | cmd.append('--tags') |
| 1910 | 1912 | ||
| 1913 | if prune: | ||
| 1914 | cmd.append('--prune') | ||
| 1915 | |||
| 1911 | spec = [] | 1916 | spec = [] |
| 1912 | if not current_branch_only: | 1917 | if not current_branch_only: |
| 1913 | # Fetch whole repo | 1918 | # Fetch whole repo |
diff --git a/subcmds/init.py b/subcmds/init.py index dbb6ddda..b8e3de5a 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -179,7 +179,7 @@ to update the working directory files. | |||
| 179 | r.Save() | 179 | r.Save() |
| 180 | 180 | ||
| 181 | groups = re.split(r'[,\s]+', opt.groups) | 181 | groups = re.split(r'[,\s]+', opt.groups) |
| 182 | all_platforms = ['linux', 'darwin'] | 182 | all_platforms = ['linux', 'darwin', 'windows'] |
| 183 | platformize = lambda x: 'platform-' + x | 183 | platformize = lambda x: 'platform-' + x |
| 184 | if opt.platform == 'auto': | 184 | if opt.platform == 'auto': |
| 185 | if (not opt.mirror and | 185 | if (not opt.mirror and |
| @@ -188,7 +188,7 @@ to update the working directory files. | |||
| 188 | elif opt.platform == 'all': | 188 | elif opt.platform == 'all': |
| 189 | groups.extend(map(platformize, all_platforms)) | 189 | groups.extend(map(platformize, all_platforms)) |
| 190 | elif opt.platform in all_platforms: | 190 | elif opt.platform in all_platforms: |
| 191 | groups.extend(platformize(opt.platform)) | 191 | groups.append(platformize(opt.platform)) |
| 192 | elif opt.platform != 'none': | 192 | elif opt.platform != 'none': |
| 193 | print('fatal: invalid platform flag', file=sys.stderr) | 193 | print('fatal: invalid platform flag', file=sys.stderr) |
| 194 | sys.exit(1) | 194 | sys.exit(1) |
diff --git a/subcmds/rebase.py b/subcmds/rebase.py index 1bdc1f0b..74796970 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py | |||
| @@ -54,6 +54,11 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 54 | p.add_option('--auto-stash', | 54 | p.add_option('--auto-stash', |
| 55 | dest='auto_stash', action='store_true', | 55 | dest='auto_stash', action='store_true', |
| 56 | help='Stash local modifications before starting') | 56 | help='Stash local modifications before starting') |
| 57 | p.add_option('-m', '--onto-manifest', | ||
| 58 | dest='onto_manifest', action='store_true', | ||
| 59 | help='Rebase onto the manifest version instead of upstream ' | ||
| 60 | 'HEAD. This helps to make sure the local tree stays ' | ||
| 61 | 'consistent if you previously synced to a manifest.') | ||
| 57 | 62 | ||
| 58 | def Execute(self, opt, args): | 63 | def Execute(self, opt, args): |
| 59 | all_projects = self.GetProjects(args) | 64 | all_projects = self.GetProjects(args) |
| @@ -106,6 +111,10 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 106 | if opt.interactive: | 111 | if opt.interactive: |
| 107 | args.append("-i") | 112 | args.append("-i") |
| 108 | 113 | ||
| 114 | if opt.onto_manifest: | ||
| 115 | args.append('--onto') | ||
| 116 | args.append(project.revisionExpr) | ||
| 117 | |||
| 109 | args.append(upbranch.LocalMerge) | 118 | args.append(upbranch.LocalMerge) |
| 110 | 119 | ||
| 111 | print('# %s: rebasing %s -> %s' | 120 | print('# %s: rebasing %s -> %s' |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 2a77065c..4af411c9 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -151,6 +151,9 @@ The --optimized-fetch option can be used to only fetch projects that | |||
| 151 | are fixed to a sha1 revision if the sha1 revision does not already | 151 | are fixed to a sha1 revision if the sha1 revision does not already |
| 152 | exist locally. | 152 | exist locally. |
| 153 | 153 | ||
| 154 | The --prune option can be used to remove any refs that no longer | ||
| 155 | exist on the remote. | ||
| 156 | |||
| 154 | SSH Connections | 157 | SSH Connections |
| 155 | --------------- | 158 | --------------- |
| 156 | 159 | ||
| @@ -234,6 +237,8 @@ later is required to fix a server side protocol bug. | |||
| 234 | p.add_option('--optimized-fetch', | 237 | p.add_option('--optimized-fetch', |
| 235 | dest='optimized_fetch', action='store_true', | 238 | dest='optimized_fetch', action='store_true', |
| 236 | help='only fetch projects fixed to sha1 if revision does not exist locally') | 239 | help='only fetch projects fixed to sha1 if revision does not exist locally') |
| 240 | p.add_option('--prune', dest='prune', action='store_true', | ||
| 241 | help='delete refs that no longer exist on the remote') | ||
| 237 | if show_smart: | 242 | if show_smart: |
| 238 | p.add_option('-s', '--smart-sync', | 243 | p.add_option('-s', '--smart-sync', |
| 239 | dest='smart_sync', action='store_true', | 244 | dest='smart_sync', action='store_true', |
| @@ -305,7 +310,8 @@ later is required to fix a server side protocol bug. | |||
| 305 | force_sync=opt.force_sync, | 310 | force_sync=opt.force_sync, |
| 306 | clone_bundle=not opt.no_clone_bundle, | 311 | clone_bundle=not opt.no_clone_bundle, |
| 307 | no_tags=opt.no_tags, archive=self.manifest.IsArchive, | 312 | no_tags=opt.no_tags, archive=self.manifest.IsArchive, |
| 308 | optimized_fetch=opt.optimized_fetch) | 313 | optimized_fetch=opt.optimized_fetch, |
| 314 | prune=opt.prune) | ||
| 309 | self._fetch_times.Set(project, time.time() - start) | 315 | self._fetch_times.Set(project, time.time() - start) |
| 310 | 316 | ||
| 311 | # Lock around all the rest of the code, since printing, updating a set | 317 | # Lock around all the rest of the code, since printing, updating a set |
| @@ -314,6 +320,7 @@ later is required to fix a server side protocol bug. | |||
| 314 | did_lock = True | 320 | did_lock = True |
| 315 | 321 | ||
| 316 | if not success: | 322 | if not success: |
| 323 | err_event.set() | ||
| 317 | print('error: Cannot fetch %s' % project.name, file=sys.stderr) | 324 | print('error: Cannot fetch %s' % project.name, file=sys.stderr) |
| 318 | if opt.force_broken: | 325 | if opt.force_broken: |
| 319 | print('warn: --force-broken, continuing to sync', | 326 | print('warn: --force-broken, continuing to sync', |
| @@ -324,7 +331,7 @@ later is required to fix a server side protocol bug. | |||
| 324 | fetched.add(project.gitdir) | 331 | fetched.add(project.gitdir) |
| 325 | pm.update() | 332 | pm.update() |
| 326 | except _FetchError: | 333 | except _FetchError: |
| 327 | err_event.set() | 334 | pass |
| 328 | except Exception as e: | 335 | except Exception as e: |
| 329 | print('error: Cannot fetch %s (%s: %s)' \ | 336 | print('error: Cannot fetch %s (%s: %s)' \ |
| 330 | % (project.name, type(e).__name__, str(e)), file=sys.stderr) | 337 | % (project.name, type(e).__name__, str(e)), file=sys.stderr) |
