Force commit changes to the file and stdout
341183
def flush(self):
        
        if not self.nostdout:
            self.stdout.flush()
        if self.file is not None:
            self.file.flush()
877319
def commitLine(self, line) :
		""""""
		if self.streamBuffer is None :
			raise ValueError("Commit lines is only for when you are streaming to a file")

		self.streamBuffer.append(line)
		if len(self.streamBuffer) % self.writeRate == 0 :
			for i in xrange(len(self.streamBuffer)) :
				self.streamBuffer[i] = str(self.streamBuffer[i])
			self.streamFile.write("%s\n" % ('\n'.join(self.streamBuffer)))
			self.streamFile.flush()
			self.streamBuffer = []
115198
def main(commit_only=True):
    
    global TEMP_FOLDER
    exit_code = 0
    hook_checks = HookConfig(get_config_file())
    with files_to_check(commit_only) as files:
        for name, mod in checks():
            default = getattr(mod, 'DEFAULT', 'off')
            if hook_checks.is_enabled(name, default=default):
                if hasattr(mod, 'REQUIRED_FILES'):
                    for filename in mod.REQUIRED_FILES:
                        if os.path.isfile(filename):
                            try:
                                shutil.copy(filename, TEMP_FOLDER)
                            except shutil.Error:
                                # Copied over by a previous check
                                continue
                args = hook_checks.arguments(name)

                tmp_files = [os.path.join(TEMP_FOLDER, f) for f in files]

                if args:
                    errors = mod.run(tmp_files, TEMP_FOLDER, args)
                else:
                    errors = mod.run(tmp_files, TEMP_FOLDER)
                if errors:
                    title_print("Checking {0}".format(name))
                    print((errors.replace(TEMP_FOLDER + "/", '')))
                    print("")
                    exit_code = 1

    if exit_code == 1:
        title_print("Rejecting commit")
    return exit_code
55138
def get_changed_files(self) -> List[str]:
        
        out = shell_tools.output_of(
            'git',
            'diff',
            '--name-only',
            self.compare_commit_id,
            self.actual_commit_id,
            '--',
            cwd=self.destination_directory)
        return [e for e in out.split('\n') if e.strip()]
1002198
def run_commit_hook(name, index, *args):
    
    hp = hook_path(name, index.repo.git_dir)
    if not os.access(hp, os.X_OK):
        return

    env = os.environ.copy()
    env['GIT_INDEX_FILE'] = safe_decode(index.path) if PY3 else safe_encode(index.path)
    env['GIT_EDITOR'] = ':'
    try:
        cmd = subprocess.Popen([hp] + list(args),
                               env=env,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE,
                               cwd=index.repo.working_dir,
                               close_fds=is_posix,
                               creationflags=PROC_CREATIONFLAGS,)
    except Exception as ex:
        raise HookExecutionError(hp, ex)
    else:
        stdout = []
        stderr = []
        handle_process_output(cmd, stdout.append, stderr.append, finalize_process)
        stdout = ''.join(stdout)
        stderr = ''.join(stderr)
        if cmd.returncode != 0:
            stdout = force_text(stdout, defenc)
            stderr = force_text(stderr, defenc)
            raise HookExecutionError(hp, cmd.returncode, stderr, stdout)
960703
def changed_lines(file)
      diff = git.diff_for_file(file)
      GitDiffParser::Patch.new(diff.patch).changed_lines
    end
81508
def _push(self):
        """"""

        push_cmds = self.vcs.push_commands()
        if not push_cmds:
            return
        if utils.ask("OK to push commits to the server?"):
            for push_cmd in push_cmds:
                output = utils.system(push_cmd)
                logger.info(output)
715582
function commit() {
            _spork('git', ['commit', '-m', 'Bumping to version ' + require(pkg).version], push,
                _.partial(fulfill, 'Could not commit \'' + chalk.cyan('package.json') + '\''));
          }
1045276
def commit(*args):
    """"""
    parser = argparse.ArgumentParser(prog="%s %s" % (__package__, commit.__name__), description=commit.__doc__)
    parser.add_argument('FILENAME', help="file(s) to commit", nargs="*", default=['.'])
    args = parser.parse_args(args)

    config = FragmentsConfig()

    for s, curr_path in _iterate_over_files(args.FILENAME, config, statuses='MAD'):
        key = os.path.relpath(curr_path, config.root)
        if key not in config['files']:
            yield "Could not commit '%s' because it is not being followed" % os.path.relpath(curr_path)
            continue

        if s in 'MA':
            repo_path = os.path.join(config.directory, config['files'][key])
            with _smart_open(repo_path, 'w') as repo_file:
                with _smart_open(curr_path, 'r') as curr_file:
                    repo_file.write(curr_file.read())
            os.utime(repo_path, os.stat(curr_path)[7:9])
            yield "'%s' committed" % os.path.relpath(curr_path)
        elif s == 'D':
            yield "Could not commit '%s' because it has been removed, instead revert or forget it" % os.path.relpath(curr_path)
        elif s == ' ':
            yield "Could not commit '%s' because it has not been changed" % os.path.relpath(curr_path)
900072
def post_commit_hook(argv):
    """"""
    _, stdout, _ = run("git log -1 --format=%B HEAD")
    message = "\n".join(stdout)
    options = {"allow_empty": True}

    if not _check_message(message, options):
        click.echo(
            "Commit message errors (fix with 'git commit --amend').",
            file=sys.stderr)
        return 1  # it should not fail with exit
    return 0
1346385
def update(**kwargs):
    '''
    
    '''
    stdout = {}

    for mode in ('fetch', 'install'):
        err_ = {}
        ret = _wrapper(mode, err_=err_, **kwargs)
        if 'retcode' in err_ and err_['retcode'] != 0:
            return ret
        if 'stdout' in err_:
            stdout[mode] = err_['stdout']
    return '\n'.join(['{0}: {1}'.format(k, v) for (k, v) in six.iteritems(stdout)])
58845
function repoIsClean (done) {
  proc.exec('git status -z', function (err, stdout) {
    if (!err) {
      var msg = stdout.toString().trim();
      if (msg && msg.length) {
        err = new Error('Please commit all changes generated by building');
      }
    }
    done(err);
  });
}
144560
def pre_release(version):
    """"""
    create_branch(version)
    changelog(version, write_out=True)

    check_call(["git", "commit", "-a", "-m", f"Preparing release {version}"])

    print()
    print(f"{Fore.GREEN}Please push your branch to your fork and open a PR.")
819583
def commit_msg_hook(argv):
    """"""
    with open(argv[1], "r", "utf-8") as fh:
        message = "\n".join(filter(lambda x: not x.startswith("#"),
                                   fh.readlines()))
    options = {"allow_empty": True}

    if not _check_message(message, options):
        click.echo(
            "Aborting commit due to commit message errors (override with "
            "'git commit --no-verify').", file=sys.stderr)
        raise click.Abort
    return 0
995617
def run(files, temp_folder, arg=None):
    ""
    parser = get_parser()
    argos = parser.parse_args(arg.split())

    current_branch = bash('git symbolic-ref HEAD').value()
    current_branch = current_branch.replace('refs/heads/', '').strip()
    if current_branch in argos.branches:
        return ("Branch '{0}' is blocked from being "
                "committed to.".format(current_branch))
1352028
function ensureNoChangesOnMasterBeforePublish() {
    //Let users try the build script as long as they're not doing an actual publish
    if (!SHOULD_PUBLISH) {
        return true;
    }

    shell.exec("git fetch origin", {silent: true});

    const currentBranch = shell.exec("git symbolic-ref --short -q HEAD", {silent: true});
    if (currentBranch.stdout.trim() !== "master") {
        shell.echo("Modules can only be deployed off 'master' branch.");
        shell.exit(-1);
    }

    const changesOnBranch = shell.exec("git log HEAD..origin/master --oneline", {silent: true});
    if (changesOnBranch.stdout.trim() !== "") {
        shell.echo("Local repo and origin are out of sync! Have you pushed all your changes? Have you pulled the latest?");
        shell.exit(-1);
    }

    const localChanges = shell.exec("git status --porcelain", {silent: true});
    if (localChanges.stdout.trim() !== "") {
        shell.echo("This git repository is has uncommitted files. Publish aborted!");
        shell.exit(-1);
    }
}
296987
def commit(self):
        """"""
        self.git.add('-A', '.')
        try:
            self.git.commit('-m', self.commit_msg)
            return True
        except sh.ErrorReturnCode_1:
            return False