Class: TFSGraph::Populators::ForBranch

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/tfs_graph/populators/for_branch.rb

Overview

incremental updates for a branch and its changesets does not update merges. have to do that once all changesets for a project are fetched

Constant Summary

Constants included from StoreHelpers

StoreHelpers::UPDATED_KEY

Instance Method Summary collapse

Methods included from Utilities

#clean, #finalize, #find_branch, #find_project

Methods included from StoreHelpers

#flush_all, #last_updated_on, #mark_as_updated

Constructor Details

#initialize(project, branch) ⇒ ForBranch

Returns a new instance of ForBranch.



10
11
12
13
14
15
# File 'lib/tfs_graph/populators/for_branch.rb', line 10

def initialize(project, branch)
  @project = project
  @branch = branch

  @changeset_store = ChangesetStore.new(branch)
end

Instance Method Details

#populateObject



17
18
19
# File 'lib/tfs_graph/populators/for_branch.rb', line 17

def populate
  populate_since(@branch.last_updated.iso8601)
end

#populate_since(time) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tfs_graph/populators/for_branch.rb', line 21

def populate_since(time)
  new_changesets = @changeset_store.fetch_since_date(time)
  @changeset_store.cache_all new_changesets

  # skip rebuilding tree or marking as updated if no new were found
  return new_changesets if new_changesets.empty?

  ChangesetTreeBuilder.to_tree(@branch, @branch.changesets.sort)

  @branch.updated!
  new_changesets
end