Class: Hglib::Extension::Topic::Entry
- Inherits:
-
Object
- Object
- Hglib::Extension::Topic::Entry
- Extended by:
- MethodUtilities
- Includes:
- Inspection
- Defined in:
- lib/hglib/extension/topic.rb
Overview
A topic in an Hglib::Repo.
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
The name of the branch the topic is on.
-
#changeset_count ⇒ Object
(also: #changesetcount)
readonly
The number of changesets belonging to the topic.
-
#last_touched ⇒ Object
(also: #lasttouched)
readonly
The human description of when the topic last had changesets added to it (if it was fetched).
-
#name ⇒ Object
readonly
The name of the topic.
-
#repo ⇒ Object
readonly
The Hglib::Repo of the repository the topic belongs to.
-
#user_touched ⇒ Object
(also: #usertouched, #touched_by)
readonly
The name of the last user to add changesets to the topic (if it was fetched).
Instance Method Summary collapse
-
#active ⇒ Object
Whether or not the entry is current active.
-
#initialize(repo, entryhash) ⇒ Entry
constructor
Create a new Entry for the specified
repo
given anentryhash
like that returned by the JSON template for the ‘topics` command. -
#stack ⇒ Object
Return the changesets that belong to this topic as Hglib::Extension::Topic::StackEntry objects.
-
#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) ⇒ Entry
Create a new Entry for the specified repo
given an entryhash
like that returned by the JSON template for the ‘topics` command.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hglib/extension/topic.rb', line 20 def initialize( repo, entryhash ) @repo = repo @name = entryhash[:topic] @active = entryhash[:active] @changeset_count = entryhash[:changesetcount] @branch = entryhash[:"branches+"] @last_touched = entryhash[:lasttouched] @user_touched = entryhash[:usertouched] end |
Instance Attribute Details
#branch ⇒ Object (readonly)
The name of the branch the topic is on
46 47 48 |
# File 'lib/hglib/extension/topic.rb', line 46 def branch @branch end |
#changeset_count ⇒ Object (readonly) Also known as: changesetcount
The number of changesets belonging to the topic
54 55 56 |
# File 'lib/hglib/extension/topic.rb', line 54 def changeset_count @changeset_count end |
#last_touched ⇒ Object (readonly) Also known as: lasttouched
The human description of when the topic last had changesets added to it (if it was fetched)
60 61 62 |
# File 'lib/hglib/extension/topic.rb', line 60 def last_touched @last_touched end |
#name ⇒ Object (readonly)
The name of the topic
42 43 44 |
# File 'lib/hglib/extension/topic.rb', line 42 def name @name end |
#repo ⇒ Object (readonly)
The Hglib::Repo of the repository the topic belongs to
38 39 40 |
# File 'lib/hglib/extension/topic.rb', line 38 def repo @repo end |
#user_touched ⇒ Object (readonly) Also known as: usertouched, touched_by
The name of the last user to add changesets to the topic (if it was fetched)
65 66 67 |
# File 'lib/hglib/extension/topic.rb', line 65 def user_touched @user_touched end |
Instance Method Details
#active ⇒ Object
Whether or not the entry is current active
50 |
# File 'lib/hglib/extension/topic.rb', line 50 attr_predicate :active |
#stack ⇒ Object
Return the changesets that belong to this topic as Hglib::Extension::Topic::StackEntry objects.
88 89 90 |
# File 'lib/hglib/extension/topic.rb', line 88 def stack return self.repo.stack( self.name ) end |
#to_s ⇒ Object Also known as: inspect_details
Return the entry as a String (in a similar form to the regular ‘hg topics` output)
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/hglib/extension/topic.rb', line 71 def to_s rval = String.new( encoding: 'utf-8' ) rval << "%s (" % [ self.name ] rval << "%s" % [ self.last_touched ] if self.last_touched rval << " by %s" % [ self.user_touched ] if self.user_touched rval << ', ' if self.last_touched || self.user_touched rval << "%d changesets)" % [ self.changeset_count ] rval << " [active]" if self.active? rval.freeze return rval end |