Perform a 'git pull' in each data repository.

    > `git pull -s recursive -X theirs`
481787
def git_pull_all_repos(cat, strategy_recursive=True, strategy='theirs'):
    
    # raise RuntimeError("THIS DOESNT WORK YET!")
    log = cat.log
    log.debug("gitter.git_pull_all_repos()")
    log.warning("WARNING: using experimental `git_pull_all_repos()`!")

    all_repos = cat.PATHS.get_all_repo_folders()
    for repo_name in all_repos:
        log.info("Repo in: '{}'".format(repo_name))
        # Get the initial git SHA
        sha_beg = get_sha(repo_name)
        log.debug("Current SHA: '{}'".format(sha_beg))

        # Initialize the git repository
        repo = git.Repo(repo_name)
        # Construct the command to call
        git_comm = "git pull --verbose"
        if strategy_recursive:
            git_comm += " -s recursive"
        if strategy is not None:
            git_comm += " -X {:s}".format(strategy)
        log.debug("Calling '{}'".format(git_comm))
        # Call git command (do this manually to use desired options)
        #    Set `with_exceptions=False` to handle errors ourselves (below)
        code, out, err = repo.git.execute(
            git_comm.split(),
            with_stdout=True,
            with_extended_output=True,
            with_exceptions=False)
        # Handle output of git command
        if len(out):
            log.info(out)
        if len(err):
            log.info(err)
        # Hangle error-codes
        if code != 0:
            err_str = "Command '{}' returned exit code '{}'!".format(git_comm,
                                                                     code)
            err_str += "\n\tout: '{}'\n\terr: '{}'".format(out, err)
            log.error(err_str)
            raise RuntimeError(err_str)

        sha_end = get_sha(repo_name)
        if sha_end != sha_beg:
            log.info("Updated SHA: '{}'".format(sha_end))

    return
1149920
def clone(cls, repo_url, dest, binary='git'):
    
    cmd = [binary, 'clone', repo_url, dest]
    process, out = cls._invoke(cmd)
    cls._check_result(cmd, process.returncode)
    return cls(binary=binary, worktree=dest)
411828
public PullResult pullFromRepository(final Git git, final String remote, String remoteBranch, final String passphrase,
        final Path privateKey) {
        SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() {
            @Override
            protected void configure(OpenSshConfig.Host host, Session session) {
                session.setUserInfo(new PassphraseUserInfo(passphrase));
            }

            @Override
            protected JSch createDefaultJSch(FS fs) throws JSchException {
                if (privateKey != null) {
                    JSch defaultJSch = super.createDefaultJSch(fs);
                    defaultJSch.addIdentity(privateKey.toFile().getAbsolutePath());
                    return defaultJSch;
                } else {
                    return super.createDefaultJSch(fs);
                }
            }
        };

        try {
            return git.pull()
                .setRemote(remote)
                .setRemoteBranchName(remoteBranch)
                .setTransportConfigCallback(transport -> {
                    SshTransport sshTransport = (SshTransport) transport;
                    sshTransport.setSshSessionFactory(sshSessionFactory);
                })
                .call();
        } catch (GitAPIException e) {
            throw new IllegalStateException(e);
        }
    }
1089270
def _pull(self):
        '''
        
        '''

        pull = self.m(
            'pulling remote changes',
            cmdd=dict(cmd='git pull --tags', cwd=self.local),
            critical=False
        )
        if 'CONFLICT' in pull.get('out'):
            self.m(
                'Congratulations! You have merge conflicts in the repository!',
                state=True,
                more=pull
            )
        return pull
1005626
def recursive_copy(source, destination):
    
    if os.path.isdir(source):
        copy_tree(source, destination)
493551
def git_branch(repo_dir, branch_name, start_point='HEAD',
               force=True, verbose=True, checkout=False):
    """"""
    command = ['git', 'branch']
    if verbose:
        command.append('--verbose')
    if force:
        command.append('--force')
    command.extend([branch_name, start_point])
    branch_output = execute_git_command(command, repo_dir=repo_dir)
    if checkout:
        return git_checkout(repo_dir, branch_name)
    else:
        return branch_output
905222
def stage_all(self):
        
        LOGGER.info('Staging all files')
        self.repo.git.add(A=True)
324530
def pull(self, remote="origin", ref=None):
        """"""
        return git_pull(self.repo_dir, remote=remote, ref=ref)
1253201
def repo_branches(self, repo):
        
        branches = []
        try:
            # switch to directory where repo will be cloned to
            status = self.path_dirs.apply_path(repo)
            if status[0]:
                cwd = status[1]
            else:
                self.logger.error('apply_path failed. Exiting repo_branches'
                                  ' with status ' + str(status))
                return status

            branch_output = check_output(shlex.split('git branch -a'),
                                         stderr=STDOUT,
                                         close_fds=True)
            branch_output = branch_output.split(b'\n')
            for branch in branch_output:
                br = branch.strip()
                if br.startswith(b'*'):
                    br = br[2:]
                if b'/' in br:
                    branches.append(br.rsplit(b'/', 1)[1].decode('utf-8'))
                elif br:
                    branches.append(br.decode('utf-8'))

            branches = list(set(branches))
            for branch in branches:
                try:
                    check_output(shlex.split('git checkout ' + branch),
                                 stderr=STDOUT,
                                 close_fds=True)
                except Exception as e:  # pragma: no cover
                    self.logger.error('repo_branches failed with error: ' +
                                      str(e) + ' on branch: ' + str(branch))
                    status = (False, e)
                    return status

            chdir(cwd)
            status = (True, branches)
        except Exception as e:  # pragma: no cover
            self.logger.error('repo_branches failed with error: ' + str(e))
            status = (False, e)

        return status
798083
def update(self):
        

        try:
            stdout = self.repo.pull().stdout
            logger.info(stdout)
        except:
            logger.info('Pull not working. Remote not defined?')
40388
def walk(self, top, topdown=True, ignore_file_handler=None):
        

        tree = self.git_object_by_path(top)
        if tree is None:
            raise IOError(errno.ENOENT, "No such file")

        for x in self._walk(tree, topdown):
            yield x
819230
def git_clone_all_repos(cat):
    
    log = cat.log
    log.debug("gitter.git_clone_all_repos()")

    all_repos = cat.PATHS.get_all_repo_folders()
    out_repos = cat.PATHS.get_repo_output_folders()
    for repo in all_repos:
        log.info("Repo in: '{}'".format(repo))

        if os.path.isdir(repo):
            log.info("Directory exists.")
        else:
            log.debug("Cloning directory...")
            clone(repo, cat.log, depth=max(cat.args.clone_depth, 1))

        if cat.args.purge_outputs and repo in out_repos:
            for fil in glob(os.path.join(repo, '*.json')):
                os.remove(fil)

        grepo = git.cmd.Git(repo)
        try:
            grepo.status()
        except git.GitCommandError:
            log.error("Repository does not exist!")
            raise

        # Get the initial git SHA
        sha_beg = get_sha(repo)
        log.debug("Current SHA: '{}'".format(sha_beg))

    return
1212067
def install(force=False):
    """"""
    ret, git_dir, _ = run("git rev-parse --show-toplevel")
    if ret != 0:
        click.echo(
            "ERROR: Please run from within a GIT repository.",
            file=sys.stderr)
        raise click.Abort
    git_dir = git_dir[0]

    hooks_dir = os.path.join(git_dir, HOOK_PATH)

    for hook in HOOKS:
        hook_path = os.path.join(hooks_dir, hook)
        if os.path.exists(hook_path):
            if not force:
                click.echo(
                    "Hook already exists. Skipping {0}".format(hook_path),
                    file=sys.stderr)
                continue
            else:
                os.unlink(hook_path)

        source = os.path.join(sys.prefix, "bin", "kwalitee-" + hook)
        os.symlink(os.path.normpath(source), hook_path)
    return True
153520
def git_clone(sub_repo, branch, commit = None, cwd = None, no_submodules = False):
        '''
        
        '''
        if not cwd:
            cwd = cwd = os.getcwd()
        root_dir = os.path.join(cwd,'boostorg',sub_repo)
        if not os.path.exists(os.path.join(root_dir,'.git')):
            utils.check_call("git","clone",
                "--depth=1",
                "--branch=%s"%(branch),
                "https://github.com/boostorg/%s.git"%(sub_repo),
                root_dir)
            os.chdir(root_dir)
        else:
            os.chdir(root_dir)
            utils.check_call("git","pull",
                # "--depth=1", # Can't do depth as we get merge errors.
                "--quiet","--no-recurse-submodules")
        if commit:
            utils.check_call("git","checkout","-qf",commit)
        if os.path.exists(os.path.join('.git','modules')):
            if sys.platform == 'win32':
                utils.check_call('dir',os.path.join('.git','modules'))
            else:
                utils.check_call('ls','-la',os.path.join('.git','modules'))
        if not no_submodules:
            utils.check_call("git","submodule","--quiet","update",
                "--quiet","--init","--recursive",
                )
            utils.check_call("git","submodule","--quiet","foreach","git","fetch")
        return root_dir
413202
protected function utilGitPull()
    {
        foreach (File::directories(plugins_path()) as $authorDir) {
            foreach (File::directories($authorDir) as $pluginDir) {
                if (!File::isDirectory($pluginDir.'/.git')) continue;
                $exec = 'cd ' . $pluginDir . ' && ';
                $exec .= 'git pull 2>&1';
                echo 'Updating plugin: '. basename(dirname($pluginDir)) .'.'. basename($pluginDir) . PHP_EOL;
                echo shell_exec($exec);
            }
        }

        foreach (File::directories(themes_path()) as $themeDir) {
            if (!File::isDirectory($themeDir.'/.git')) continue;
            $exec = 'cd ' . $themeDir . ' && ';
            $exec .= 'git pull 2>&1';
            echo 'Updating theme: '. basename($themeDir) . PHP_EOL;
            echo shell_exec($exec);
        }
    }
1192774
def _recursive_upsert(context, params, data):
    """"""
    children = params.get("children", {})
    nested_calls = []
    for child_params in children:
        key = child_params.get("key")
        child_data_list = ensure_list(data.pop(key))
        if isinstance(child_data_list, dict):
            child_data_list = [child_data_list]
        if not (isinstance(child_data_list, list) and
                all(isinstance(i, dict) for i in child_data_list)):
            context.log.warn(
                "Expecting a dict or a lost of dicts as children for key", key
            )
            continue
        if child_data_list:
            table_suffix = child_params.get("table_suffix", key)
            child_params["table"] = params.get("table") + "_" + table_suffix
            # copy some properties over from parent to child
            inherit = child_params.get("inherit", {})
            for child_data in child_data_list:
                for dest, src in inherit.items():
                    child_data[dest] = data.get(src)
                nested_calls.append((child_params, child_data))
    # Insert or update data
    _upsert(context, params, data)
    for child_params, child_data in nested_calls:
        _recursive_upsert(context, child_params, child_data)
429699
function pull(xs, x) {
    const idx = xs.indexOf(x);
    if (idx > -1) {
        xs.splice(idx, 1);
    }
}