Get the command to commit changes to tracked files in the working tree.
189009
def get_commit_command(self, message, author=None):
        """"""
        command = ['git']
        if author:
            command.extend(('-c', 'user.name=%s' % author.name))
            command.extend(('-c', 'user.email=%s' % author.email))
        command.append('commit')
        command.append('--all')
        command.append('--message')
        command.append(message)
        return command
1038233
def commit_status(base_commit, new_commit, ignore: [])
      base_tree = get_object(base_commit.tree) unless base_commit.nil?
      new_tree  = get_object(new_commit.tree)  unless new_commit.nil?

      Utils::Status.compare_trees base_tree,
                                  new_tree,
                                  object_store,
                                  ignore: ignore
    end
1143173
def changed_files(directory, id)
      Dir.chdir(@directory) do
        tracked_files = []
        begin
          tracked_files += run("git diff-index --name-only #{id} -- #{directory}").split
        rescue ExecutionFailed => e
          raise e if e.status != 1 # status 1 is normal
        end

        untracked_files = run("git ls-files --exclude-standard --others -- #{directory}").split
        tracked_files + untracked_files
      end
    end
219762
def get_commits_since(check_name, target_tag=None):
    
    root = get_root()
    target_path = os.path.join(root, check_name)
    command = 'git log --pretty=%s {}{}'.format('' if target_tag is None else '{}... '.format(target_tag), target_path)

    with chdir(root):
        return run_command(command, capture=True).stdout.splitlines()
1329672
@GET
    @Path("commitTree/{commitId}")
    public List<CommitTreeInfo> getCommitTree(final @PathParam("commitId") String commitId) throws Exception {
        return gitReadOperation(new GitOperation<List<CommitTreeInfo>>() {
            @Override
            public List<CommitTreeInfo> call(Git git, GitContext context) throws Exception {
                return doGetCommitTree(git, commitId);
            }
        });
    }
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()]
1179862
def changed_path(self):
        ""
        result = None  # default
        for path in self.paths_to_modification_times:
            lastmod = self.paths_to_modification_times[path]
            mod = os.path.getmtime(path)
            if mod > lastmod:
                result = "Watch file has been modified: " + repr(path)
            self.paths_to_modification_times[path] = mod
        for folder in self.folder_paths:
            for filename in os.listdir(folder):
                subpath = os.path.join(folder, filename)
                if os.path.isfile(subpath) and subpath not in self.paths_to_modification_times:
                    result = "New file in watched folder: " + repr(subpath)
                    self.add(subpath)
        if self.check_python_modules:
            # refresh the modules
            self.add_all_modules()
        if self.check_javascript:
            self.watch_javascript()
        return result
1073104
@RequestMapping(value = "changelog/{uuid}/commits", method = RequestMethod.GET)
    public GitChangeLogCommits changeLogCommits(@PathVariable String uuid) {
        // Gets the change log
        GitChangeLog changeLog = getChangeLog(uuid);
        // Cached?
        GitChangeLogCommits commits = changeLog.getCommits();
        if (commits != null) {
            return commits;
        }
        // Loads the commits
        GitChangeLogCommits loadedCommits = changeLog.loadCommits(gitService::getChangeLogCommits);
        // Stores in cache
        logCache.put(uuid, changeLog);
        // OK
        return loadedCommits;
    }
61188
def get_last_commit_modifying_files(repo: Repo, *files) -> str:
    
    return repo.git.log(*files, n=1, format="%H")
1138056
def sync(self):
        ''''''
        if self.flag == 'r':
            return
        filename = self.filename
        tempname = filename + '.tmp'
        fileobj = open(tempname, 'wb' if self.file_format == 'pickle' else 'w')
        try:
            self.dump(fileobj)
        except Exception:
            os.remove(tempname)
            raise
        finally:
            fileobj.close()
        shutil.move(tempname, self.filename)    # atomic commit
        if self.mode is not None:
            os.chmod(self.filename, self.mode)
1049241
def get_git_changeset():
    """"""
    git_log = Popen(
        'git log --pretty=format:%ct --quiet -1 HEAD',
        stdout=PIPE, stderr=PIPE, shell=True, universal_newlines=True)
    timestamp = git_log.communicate()[0]
    try:
        timestamp = datetime.utcfromtimestamp(int(timestamp))
    except ValueError:
        return None
    return timestamp.strftime('%Y%m%d%H%M%S')
571391
def commit(self):
        
        assert self.record
        result = self.files_written, self.dirs_created
        self._init_record()
        return result
773096
def _get_changes(rsync_out):
    '''
    
    '''
    copied = list()
    deleted = list()

    for line in rsync_out.split("\n\n")[0].split("\n")[1:]:
        if line.startswith("deleting "):
            deleted.append(line.split(" ", 1)[-1])
        else:
            copied.append(line)

    ret = {
        'copied': os.linesep.join(sorted(copied)) or "N/A",
        'deleted': os.linesep.join(sorted(deleted)) or "N/A",
    }

    # Return whether anything really changed
    ret['changed'] = not ((ret['copied'] == 'N/A') and (ret['deleted'] == 'N/A'))

    return ret
1216887
function commit() {
		console.log( "Adding files to dist..." );
		Release.exec( "git add -A", "Error adding files." );
		Release.exec(
			"git commit -m \"Release " + Release.newVersion + "\"",
			"Error committing files."
		);
		console.log();

		console.log( "Tagging release on dist..." );
		Release.exec( "git tag " + Release.newVersion,
			"Error tagging " + Release.newVersion + " on dist repo." );
		Release.tagTime = Release.exec( "git log -1 --format=\"%ad\"",
			"Error getting tag timestamp." ).trim();
	}
63211
function getCommits(repo, branchName) {
  return caller.call(repo, repo.commits, branchName)
  .then(function (commits) {
    return commits.map(function (commitObj) {
      return {
        id: commitObj.id,
        message: commitObj.message,
        committed_date: commitObj.committed_date
      }
    })
  })
}
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)
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