Class: TFSGraph::ChangesetStore

Inherits:
AbstractStore show all
Defined in:
lib/tfs_graph/changeset/changeset_store.rb

Constant Summary collapse

LIMIT =
10000

Constants included from StoreHelpers

StoreHelpers::UPDATED_KEY

Constants included from TFSClient

TFSClient::InvalidConfig, TFSClient::REQUIRED_KEYS

Instance Method Summary collapse

Methods inherited from AbstractStore

#cache_all, #fetch_all, #fetch_and_cache

Methods included from StoreHelpers

#flush_all, #last_updated_on, #mark_as_updated

Methods included from TFSHelpers

#base_username, #branch_base, #branch_path_to_name, #branch_project, #odata_path_to_server_path, #scrub_changeset, #server_path_to_odata_path

Methods included from TFSClient

#endpoint, #setup, #tfs, #tfs=

Constructor Details

#initialize(branch) ⇒ ChangesetStore

Returns a new instance of ChangesetStore.



12
13
14
# File 'lib/tfs_graph/changeset/changeset_store.rb', line 12

def initialize(branch)
  @branch = branch
end

Instance Method Details

#cache(attrs) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/tfs_graph/changeset/changeset_store.rb', line 24

def cache(attrs)
  changeset = RepositoryRegistry.changeset_repository.build attrs

  # add_changeset action runs save! on changeset
  @branch.add_changeset changeset

  changeset
end

#fetch_since_date(date) ⇒ Object



20
21
22
# File 'lib/tfs_graph/changeset/changeset_store.rb', line 20

def fetch_since_date(date)
  normalize root_query.where("CreationDate gt DateTime'#{date}'").run
end

#fetch_since_last_updateObject



16
17
18
# File 'lib/tfs_graph/changeset/changeset_store.rb', line 16

def fetch_since_last_update
  fetch_since_date(@branch.last_updated.iso8601)
end