Class: Hglib::Repo::LogEntry

Inherits:
Object
  • Object
show all
Extended by:
Loggability
Defined in:
lib/hglib/repo/log_entry.rb

Overview

An entry in a repository’s revision log.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bookmarksObject (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

#branchObject (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

#descObject (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

#diffObject (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

#filesObject (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

#nodeObject (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

#parentsObject (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

#phaseObject (readonly)

Return the phase from the entry



75
76
77
# File 'lib/hglib/repo/log_entry.rb', line 75

def phase
  @phase
end

#revObject (readonly)

Return the revision number from the entry



79
80
81
# File 'lib/hglib/repo/log_entry.rb', line 79

def rev
  @rev
end

#tagsObject (readonly)

Return the Array of the entry’s tags



83
84
85
# File 'lib/hglib/repo/log_entry.rb', line 83

def tags
  @tags
end

#userObject (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

#changesetObject

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

#dateObject 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

#inspectObject

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.tags.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