Class: Hglib::Extension::Topic::StackEntry
- Inherits:
-
Object
- Object
- Hglib::Extension::Topic::StackEntry
- Extended by:
- MethodUtilities
- Includes:
- Inspection
- Defined in:
- lib/hglib/extension/topic.rb
Overview
A changeset in a topic
Instance Attribute Summary collapse
-
#description ⇒ Object
(also: #desc)
readonly
The changeset description.
-
#node ⇒ Object
readonly
The node identifier of the changeset.
-
#repo ⇒ Object
readonly
The Hglib::Repo of the repository the changeset belongs to.
-
#stack_index ⇒ Object
readonly
The index of the changeset in the topic it is currently in.
-
#state ⇒ Object
readonly
An array of states that apply to this changeset(?) :TODO: Figure out what these mean.
-
#symbol ⇒ Object
readonly
A character that represents the changeset’s (state?) :TODO: Figure out what this means.
Instance Method Summary collapse
-
#initialize(repo, entryhash) ⇒ StackEntry
constructor
Create a new StackEntry for the specified
repo
given anentryhash
like that returned by the JSON template for the ‘topics` command. -
#is_entry ⇒ Object
True if the changeset is an entry(?) :TODO: Figure out what this means.
-
#to_s ⇒ Object
(also: #inspect_details)
Return the entry as a String (in a similar form to the regular ‘hg topics` output).
Methods included from MethodUtilities
attr_predicate, attr_predicate_accessor, singleton_attr_accessor, singleton_attr_reader, singleton_attr_writer, singleton_method_alias
Methods included from Inspection
Constructor Details
#initialize(repo, entryhash) ⇒ StackEntry
Create a new StackEntry for the specified repo
given an entryhash
like that returned by the JSON template for the ‘topics` command.
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/hglib/extension/topic.rb', line 103 def initialize( repo, entryhash ) @repo = repo @description = entryhash[:desc] @is_entry = entryhash[:isentry] @node = entryhash[:node] @stack_index = entryhash[:stack_index] @state = entryhash[:state] @symbol = entryhash[:symbol] end |
Instance Attribute Details
#description ⇒ Object (readonly) Also known as: desc
The changeset description
125 126 127 |
# File 'lib/hglib/extension/topic.rb', line 125 def description @description end |
#node ⇒ Object (readonly)
The node identifier of the changeset
136 137 138 |
# File 'lib/hglib/extension/topic.rb', line 136 def node @node end |
#repo ⇒ Object (readonly)
The Hglib::Repo of the repository the changeset belongs to
121 122 123 |
# File 'lib/hglib/extension/topic.rb', line 121 def repo @repo end |
#stack_index ⇒ Object (readonly)
The index of the changeset in the topic it is currently in
140 141 142 |
# File 'lib/hglib/extension/topic.rb', line 140 def stack_index @stack_index end |
#state ⇒ Object (readonly)
An array of states that apply to this changeset(?) :TODO: Figure out what these mean
145 146 147 |
# File 'lib/hglib/extension/topic.rb', line 145 def state @state end |
#symbol ⇒ Object (readonly)
A character that represents the changeset’s (state?) :TODO: Figure out what this means
150 151 152 |
# File 'lib/hglib/extension/topic.rb', line 150 def symbol @symbol end |
Instance Method Details
#is_entry ⇒ Object
True if the changeset is an entry(?) :TODO: Figure out what this means
131 |
# File 'lib/hglib/extension/topic.rb', line 131 attr_predicate :is_entry |
#to_s ⇒ Object Also known as: inspect_details
Return the entry as a String (in a similar form to the regular ‘hg topics` output)
154 155 156 157 158 159 160 161 162 163 |
# File 'lib/hglib/extension/topic.rb', line 154 def to_s displayed_states = self.state - ['clean'] rval = String.new( encoding: 'utf-8' ) rval << %{s%d%s "%s"} % [ self.stack_index, self.symbol, self.description ] rval << " (%s)" % [ displayed_states.join(', ') ] unless displayed_states.empty? rval.freeze return rval end |