Class: TFSGraph::Changeset
Constant Summary
collapse
- SCHEMA =
{
comment: {key: "Comment", type: String},
committer: {key: "Committer", converter: ->(name) { base_username(name) }, type: String},
created: {key: "CreationDate", type: Time},
id: {key: "Id", type: Integer},
branch_path: {type: String, default: nil},
parent: {type: Integer, default: 0},
merge_parent: {type: Integer, default: 0}
}
PersistableEntity::NotPersisted
Instance Attribute Summary
#db_object
Instance Method Summary
collapse
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
#delete!, #initialize, #persist, #persisted?, repository, #save!, #to_hash
Methods included from Extensions
#base_class_name
Methods inherited from Entity
inherited, #initialize, #schema, #to_hash
Instance Method Details
#<=>(other) ⇒ Object
22
23
24
|
# File 'lib/tfs_graph/changeset.rb', line 22
def <=>(other)
id <=> other.id
end
|
#add_child(changeset) ⇒ Object
53
54
55
|
# File 'lib/tfs_graph/changeset.rb', line 53
def add_child(changeset)
@repo.relate(:child, self.db_object, changeset.db_object)
end
|
#as_json(options = {}) ⇒ Object
82
83
84
85
86
87
88
89
90
|
# File 'lib/tfs_graph/changeset.rb', line 82
def as_json(options={})
results = super
[:merges_ids, :merged_ids].each do |key|
results[key] = self.send key
end
results
end
|
#base? ⇒ Boolean
43
44
45
|
# File 'lib/tfs_graph/changeset.rb', line 43
def base?
@parent == 0 || @parent == @merge_parent
end
|
#branch ⇒ Object
63
64
65
|
# File 'lib/tfs_graph/changeset.rb', line 63
def branch
@repo.get_nodes(db_object, :incoming, :changesets, Branch).first
end
|
#created ⇒ Object
47
48
49
50
51
|
# File 'lib/tfs_graph/changeset.rb', line 47
def created
return nil unless @created
return @created unless @created.is_a? String
@created = Time.parse @created
end
|
#eql?(other) ⇒ Boolean
override for the & (intersect) operator
27
28
29
|
# File 'lib/tfs_graph/changeset.rb', line 27
def eql?(other)
other.is_a?(self.class) && other == self
end
|
67
68
69
|
# File 'lib/tfs_graph/changeset.rb', line 67
def formatted_created
created.strftime("%m/%d/%Y")
end
|
#hash ⇒ Object
31
32
33
|
# File 'lib/tfs_graph/changeset.rb', line 31
def hash
@internal_id.hash
end
|
#id ⇒ Object
35
36
37
|
# File 'lib/tfs_graph/changeset.rb', line 35
def id
@id.to_i unless @id.nil?
end
|
#merge? ⇒ Boolean
39
40
41
|
# File 'lib/tfs_graph/changeset.rb', line 39
def merge?
!base? && @merge_parent != 0
end
|
#next ⇒ Object
57
58
59
60
61
|
# File 'lib/tfs_graph/changeset.rb', line 57
def next
child = @repo.get_nodes(db_object, :outgoing, :child, self.class).first
raise StopIteration unless child
child
end
|