class TFSGraph::ChangesetMerge

Constants

SCHEMA

Public Class Methods

create(attrs) click to toggle source

overwrite the creator, and create a relationship between the two changesets requested instead of a distinct object

# File lib/tfs_graph/changeset_merge.rb, line 15
def self.create(attrs)
  begin
    merge = new(attrs)

    target, source = merge.get_relations
    return nil unless target.persisted? and source.persisted?

    merge.join :merges, target, source

    # relate the branches as well
    if source.branch && target.branch
      merge.join :related, source.branch, target.branch

      merge.join :included, source.branch, target
      merge.join :included, target.branch, source
    end

    merge
  rescue TFSGraph::Repository::NotFound => ex
    # puts "Could not find a changeset to merge with: #{ex.message}"
  end
end

Public Instance Methods

get_relations() click to toggle source
# File lib/tfs_graph/changeset_merge.rb, line 38
def get_relations
  return get_target, get_source
end
get_source() click to toggle source
# File lib/tfs_graph/changeset_merge.rb, line 42
def get_source
  repo.find(source_version)
end
get_target() click to toggle source
# File lib/tfs_graph/changeset_merge.rb, line 46
def get_target
  repo.find(target_version)
end
join(relation, target, source) click to toggle source
# File lib/tfs_graph/changeset_merge.rb, line 50
def join(relation, target, source)
  repo.relate(relation, target.db_object, source.db_object)
end

Private Instance Methods

repo() click to toggle source
# File lib/tfs_graph/changeset_merge.rb, line 55
def repo
  @repo ||= RepositoryRegistry.changeset_repository
end