Exemple #1
0
    def testSyncWithOptions(self):
        """Test gclient.Sync() with optional arguments."""
        gclient.Sync(self.fake_gclient, self.cwd, reset=True)
        self.assertCommandCalled([
            self.fake_gclient, 'sync', '--with_branch_heads', '--with_tags',
            '--reset', '--force', '--delete_unversioned_trees', '--nohooks',
            '--verbose'
        ],
                                 cwd=self.cwd)

        gclient.Sync(self.fake_gclient, self.cwd, nohooks=False, verbose=False)
        self.assertCommandCalled(
            [self.fake_gclient, 'sync', '--with_branch_heads', '--with_tags'],
            cwd=self.cwd)

        gclient.Sync(self.fake_gclient,
                     self.cwd,
                     nohooks=False,
                     verbose=False,
                     ignore_locks=True)
        self.assertCommandCalled([
            self.fake_gclient, 'sync', '--with_branch_heads', '--with_tags',
            '--ignore_locks'
        ],
                                 cwd=self.cwd)
Exemple #2
0
 def testSync(self):
     """Test gclient.Sync() without optional arguments."""
     gclient.Sync(self.fake_gclient, self.cwd)
     self.assertCommandCalled([
         self.fake_gclient, 'sync', '--with_branch_heads', '--with_tags',
         '--nohooks', '--verbose'
     ],
                              cwd=self.cwd)
Exemple #3
0
def SyncChrome(gclient_path, options):
    """Sync new Chrome."""
    gclient.WriteConfigFile(gclient_path, options.chrome_root,
                            options.internal, options.version,
                            options.gclient_template, options.use_cache)
    gclient.Sync(gclient_path,
                 options.chrome_root,
                 reset=options.reset,
                 ignore_locks=options.ignore_locks)
def SyncChrome(gclient_path, options):
    """Sync new Chrome."""
    gclient.WriteConfigFile(gclient_path,
                            options.chrome_root,
                            options.internal,
                            options.version,
                            options.gclient_template,
                            options.use_cache,
                            git_cache_dir=options.git_cache_dir)
    gclient.Sync(gclient_path, options.chrome_root, reset=options.reset)
Exemple #5
0
    def testSyncWithRunArgs(self):
        """Test gclient.Sync() with run_args.

    run_args is an optional argument for run kwargs.
    """
        gclient.Sync(self.fake_gclient,
                     self.cwd,
                     run_args={'log_output': True})
        self.assertCommandCalled([
            self.fake_gclient, 'sync', '--with_branch_heads', '--with_tags',
            '--nohooks', '--verbose'
        ],
                                 cwd=self.cwd,
                                 log_output=True)
Exemple #6
0
def main(args):
    parser = GetParser()
    options = parser.parse_args(args)

    # Revert any lingering local changes.
    if not osutils.SafeMakedirs(options.chrome_root) and options.reset:
        try:
            gclient.Revert(options.gclient, options.chrome_root)
        except cros_build_lib.RunCommandError:
            osutils.RmDir(options.chrome_root)
            osutils.SafeMakedirs(options.chrome_root)

    # Sync new Chrome.
    gclient.WriteConfigFile(options.gclient, options.chrome_root,
                            options.internal, options.pdf, options.version)
    gclient.Sync(options.gclient, options.chrome_root, options.reset)
    return 0
Exemple #7
0
    def GclientSync(self, reset=False, nohooks=False):
        """Runs gclient sync.

    It also sets verbose argument and redirects "gclient sync" output to log.

    Args:
      reset: Reset to pristine version of the source code.
      nohooks: If set, add '--nohooks' argument.

    Returns:
      A CommandResult object.
    """
        return gclient.Sync(self.gclient,
                            self.chromium_dir,
                            reset=reset,
                            nohooks=nohooks,
                            verbose=self.verbose,
                            run_args=self.log_output_args)