diff options
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 43d450be..652a0c0d 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -58,6 +58,7 @@ except ImportError: | |||
58 | 58 | ||
59 | from git_command import GIT, git_require | 59 | from git_command import GIT, git_require |
60 | from git_refs import R_HEADS, HEAD | 60 | from git_refs import R_HEADS, HEAD |
61 | import gitc_utils | ||
61 | from project import Project | 62 | from project import Project |
62 | from project import RemoteSpec | 63 | from project import RemoteSpec |
63 | from command import Command, MirrorSafeCommand | 64 | from command import Command, MirrorSafeCommand |
@@ -184,6 +185,9 @@ later is required to fix a server side protocol bug. | |||
184 | help="overwrite an existing git directory if it needs to " | 185 | help="overwrite an existing git directory if it needs to " |
185 | "point to a different object directory. WARNING: this " | 186 | "point to a different object directory. WARNING: this " |
186 | "may cause loss of data") | 187 | "may cause loss of data") |
188 | p.add_option('--force-gitc', | ||
189 | dest='force_gitc', action='store_true', | ||
190 | help="actually sync sources in the gitc client directory.") | ||
187 | p.add_option('-l', '--local-only', | 191 | p.add_option('-l', '--local-only', |
188 | dest='local_only', action='store_true', | 192 | dest='local_only', action='store_true', |
189 | help="only update working tree, don't fetch") | 193 | help="only update working tree, don't fetch") |
@@ -526,6 +530,25 @@ later is required to fix a server side protocol bug. | |||
526 | print('error: both -u and -p must be given', file=sys.stderr) | 530 | print('error: both -u and -p must be given', file=sys.stderr) |
527 | sys.exit(1) | 531 | sys.exit(1) |
528 | 532 | ||
533 | cwd = os.getcwd() | ||
534 | if cwd.startswith(gitc_utils.GITC_MANIFEST_DIR) and not opt.force_gitc: | ||
535 | print('WARNING this will pull all the sources like a normal repo sync.\n' | ||
536 | '\nIf you want to update your GITC Client View please rerun this ' | ||
537 | 'command in \n%s%s.\nOr if you actually want to pull the sources, ' | ||
538 | 'rerun with --force-gitc.' % | ||
539 | (gitc_utils.GITC_FS_ROOT_DIR, | ||
540 | cwd.split(gitc_utils.GITC_MANIFEST_DIR)[1])) | ||
541 | sys.exit(1) | ||
542 | |||
543 | self._gitc_sync = False | ||
544 | if cwd.startswith(gitc_utils.GITC_FS_ROOT_DIR): | ||
545 | self._gitc_sync = True | ||
546 | self._client_name = cwd.split(gitc_utils.GITC_FS_ROOT_DIR)[1].split( | ||
547 | '/')[0] | ||
548 | self._client_dir = os.path.join(gitc_utils.GITC_MANIFEST_DIR, | ||
549 | self._client_name) | ||
550 | print('Updating GITC client: %s' % self._client_name) | ||
551 | |||
529 | if opt.manifest_name: | 552 | if opt.manifest_name: |
530 | self.manifest.Override(opt.manifest_name) | 553 | self.manifest.Override(opt.manifest_name) |
531 | 554 | ||
@@ -642,6 +665,12 @@ later is required to fix a server side protocol bug. | |||
642 | if opt.repo_upgraded: | 665 | if opt.repo_upgraded: |
643 | _PostRepoUpgrade(self.manifest, quiet=opt.quiet) | 666 | _PostRepoUpgrade(self.manifest, quiet=opt.quiet) |
644 | 667 | ||
668 | if self._gitc_sync: | ||
669 | gitc_utils.generate_gitc_manifest(self._client_dir, self.manifest) | ||
670 | print('GITC client successfully synced.') | ||
671 | return | ||
672 | |||
673 | |||
645 | if not opt.local_only: | 674 | if not opt.local_only: |
646 | mp.Sync_NetworkHalf(quiet=opt.quiet, | 675 | mp.Sync_NetworkHalf(quiet=opt.quiet, |
647 | current_branch_only=opt.current_branch_only, | 676 | current_branch_only=opt.current_branch_only, |