Class: Hglib::Repo::LogEntry
- Inherits:
-
Object
- Object
- Hglib::Repo::LogEntry
- Extended by:
- Loggability
- Defined in:
- lib/hglib/repo/log_entry.rb
Overview
An entry in a repository’s revision log.
Instance Attribute Summary collapse
-
#bookmarks ⇒ Object
readonly
Return the Array of bookmarks corresponding to the entry (if any).
-
#branch ⇒ Object
readonly
Return the name of the branch the commit is on.
-
#desc ⇒ Object
(also: #summary)
readonly
Return the description from the entry.
-
#diff ⇒ Object
readonly
The diff of the commit, if –patch was specified.
-
#files ⇒ Object
readonly
The files affected by the commit, if run with ‘verbose: true`.
-
#node ⇒ Object
readonly
Return the node (changeset ID) from the entry.
-
#parents ⇒ Object
readonly
Return the changeset IDs of the parents of the entry.
-
#phase ⇒ Object
readonly
Return the phase from the entry.
-
#rev ⇒ Object
readonly
Return the revision number from the entry.
-
#tags ⇒ Object
readonly
Return the Array of the entry’s tags.
-
#user ⇒ Object
readonly
Return the name and email of the committing user.
Instance Method Summary collapse
-
#changeset ⇒ Object
Return the shortened changeset ID (in the form #rev:shortnode).
-
#date ⇒ Object
(also: #time)
The Time the revision associated with the entry was committed.
-
#initialize(entryhash) ⇒ LogEntry
constructor
Create a new log entry from the raw
entryhash
. -
#inspect ⇒ Object
Return a human-readable representation of the LogEntry as a String.
Constructor Details
#initialize(entryhash) ⇒ LogEntry
Create a new log entry from the raw entryhash
.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/hglib/repo/log_entry.rb', line 32 def initialize( entryhash ) @bookmarks = entryhash[ :bookmarks ] @branch = entryhash[ :branch ] @date = entryhash[ :date ] @desc = entryhash[ :desc ] @node = entryhash[ :node ] @parents = entryhash[ :parents ] @phase = entryhash[ :phase ] @rev = entryhash[ :rev ] @tags = entryhash[ :tags ] @user = entryhash[ :user ] @date = entryhash[ :date ] @files = entryhash[ :files ] || [] end |
Instance Attribute Details
#bookmarks ⇒ Object (readonly)
Return the Array of bookmarks corresponding to the entry (if any)
54 55 56 |
# File 'lib/hglib/repo/log_entry.rb', line 54 def bookmarks @bookmarks end |
#branch ⇒ Object (readonly)
Return the name of the branch the commit is on
58 59 60 |
# File 'lib/hglib/repo/log_entry.rb', line 58 def branch @branch end |
#desc ⇒ Object (readonly) Also known as: summary
Return the description from the entry
62 63 64 |
# File 'lib/hglib/repo/log_entry.rb', line 62 def desc @desc end |
#diff ⇒ Object (readonly)
The diff of the commit, if –patch was specified.
91 92 93 |
# File 'lib/hglib/repo/log_entry.rb', line 91 def diff @diff end |
#files ⇒ Object (readonly)
The files affected by the commit, if run with ‘verbose: true`.
95 96 97 |
# File 'lib/hglib/repo/log_entry.rb', line 95 def files @files end |
#node ⇒ Object (readonly)
Return the node (changeset ID) from the entry
67 68 69 |
# File 'lib/hglib/repo/log_entry.rb', line 67 def node @node end |
#parents ⇒ Object (readonly)
Return the changeset IDs of the parents of the entry
71 72 73 |
# File 'lib/hglib/repo/log_entry.rb', line 71 def parents @parents end |
#phase ⇒ Object (readonly)
Return the phase from the entry
75 76 77 |
# File 'lib/hglib/repo/log_entry.rb', line 75 def phase @phase end |
#rev ⇒ Object (readonly)
Return the revision number from the entry
79 80 81 |
# File 'lib/hglib/repo/log_entry.rb', line 79 def rev @rev end |
#tags ⇒ Object (readonly)
Return the Array of the entry’s tags
83 84 85 |
# File 'lib/hglib/repo/log_entry.rb', line 83 def @tags end |
#user ⇒ Object (readonly)
Return the name and email of the committing user
87 88 89 |
# File 'lib/hglib/repo/log_entry.rb', line 87 def user @user end |
Instance Method Details
#changeset ⇒ Object
Return the shortened changeset ID (in the form #rev:shortnode)
106 107 108 |
# File 'lib/hglib/repo/log_entry.rb', line 106 def changeset return "%d:%s" % [ self.rev, self.node[0,12] ] end |
#date ⇒ Object Also known as: time
The Time the revision associated with the entry was committed
99 100 101 |
# File 'lib/hglib/repo/log_entry.rb', line 99 def date return Time.at( @date[0] ) end |
#inspect ⇒ Object
Return a human-readable representation of the LogEntry as a String.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/hglib/repo/log_entry.rb', line 112 def inspect parts = [] parts += self..map {|t| "##{t}" } parts += self.bookmarks.map {|b| "@#{b}" } return "#<%p:#%x %s {%s} %p%s>" % [ self.class, self.object_id * 2, self.changeset, self.date, self.summary, parts.empty? ? '' : " " + parts.join(' ') ] end |