Method: Cnvrg::Dataset#compare_idx

Defined in:
lib/cnvrg/dataset.rb

#compare_idx(new_branch, commit = last_local_commit, local_idx = nil, force = false, next_commit = nil) ⇒ Object



579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/cnvrg/dataset.rb', line 579

def compare_idx(new_branch, commit = last_local_commit, local_idx = nil, force = false, next_commit = nil)
  if local_idx.nil?
    local_idx = self.generate_idx
  end
  ignore_list = self.get_ignore_list()
  if force
    added = []
    if local_idx[:tree]
      added << local_idx[:tree].keys
      added.flatten!
    end

    response = {"result" => {"commit" => next_commit, "tree" => {"added" => added,
                                                                 "updated_on_server" => [],
                                                                 "updated_on_local" => [],
                                                                 "deleted" => [],
                                                                 "conflicts" => []}}}
    return response

  end
  response = Cnvrg::API.request("users/#{self.owner}/datasets/#{self.slug}/status", 'POST', {idx: local_idx, new_branch: new_branch, current_commit: commit, ignore: ignore_list, next_commit: next_commit})
  CLI.is_response_success(response, false)
  return response
end