lib/redmine/scm/adapters/undev_git_adapter.rb
# execute git command and yield block for every chunk
# chunk size gets from options[:chunk_size]
execute git command and yield block for every chunk
chunk size gets from options[:chunk_size]
execute git command and yield block for every chunk chunk size gets from options [ : chunk_size ]
def chunked_git_log(path, options, &block)
      skip = 0
      revisions = revisions_for_git_cmd(options)
      chunk_size = options[:chunk_size] || default_chunk_size
      while true
        if options[:limit]
          chunk_size = [options[:limit] - skip, chunk_size].min
        end
        cmd_args = %w{log --date=iso --date-order --name-status --no-color}
        cmd_args << "--format=#{options[:format]}"
        cmd_args << '--all' if revisions.empty? && options[:all]
        cmd_args << "--encoding=#{path_encoding}"
        cmd_args << "--skip=#{skip}" << "--max-count=#{chunk_size}"
        cmd_args << '--stdin'
        if path && !path.empty?
          cmd_args << '--' << scm_iconv(path_encoding, 'UTF-8', path)
        end
        git_log = nil
        git_cmd(cmd_args) do |stdin, stdout|
          stdin.binmode
          stdin.puts(revisions.join("\n"))
          stdin.close
          git_log = stdout.read.force_encoding(path_encoding)
        end
        begin
          return nil if git_log.blank?
        rescue ArgumentError 
          git_log = remove_invalid_characters(git_log)
        end
        git_patch_ids = patch_ids(path, revisions, chunk_size, skip)
        block.call(git_log, git_patch_ids)
        skip += chunk_size
      end
    end
def chunked_git_log ( path , options , & block ) skip = 0 revisions = revisions_for_git_cmd ( options ) chunk_size = options [ :chunk_size ] || default_chunk_size while true if options [ :limit ] chunk_size = [ options [ :limit ] - skip , chunk_size ] . min end cmd_args = %w{ log --date=iso --date-order --name-status --no-color } cmd_args << "--format=#{options[:format]}" cmd_args << '--all' if revisions . empty? && options [ :all ] cmd_args << "--encoding=#{path_encoding}" cmd_args << "--skip=#{skip}" << "--max-count=#{chunk_size}" cmd_args << '--stdin' if path && ! path . empty? cmd_args << '--' << scm_iconv ( path_encoding , 'UTF-8' , path ) end git_log = nil git_cmd ( cmd_args ) do | stdin , stdout | stdin . binmode stdin . puts ( revisions . join ( "\n" ) ) stdin . close git_log = stdout . read . force_encoding ( path_encoding ) end begin return nil if git_log . blank? rescue ArgumentError git_log = remove_invalid_characters ( git_log ) end git_patch_ids = patch_ids ( path , revisions , chunk_size , skip ) block . call ( git_log , git_patch_ids ) skip += chunk_size end end
execute git command and yield block for every chunk
chunk size gets from options[:chunk_size]
execute git command and yield block for every chunk chunk size gets from options [ : chunk_size ]
#invalid byte sequence in UTF-8 # get patch_ids for commits
path
<not_specific>
options
<not_specific>
block
<not_specific>