StatusEntry

class
Superclass
Object
Extended With
Loggability

An entry in a repository's status list.

Attributes

path[R]

Return the Pathname of the file the status applies to

source[R]

The Pathname of the file the status applies to was copied from (if the status is `A`/`added`) and the addition was via a copy/move operation.

status[R]

Return the character that denotes the file's status

Public Class Methods

anchor
new( entryhash )

Create a new log entry from the raw entryhash.

# File lib/hglib/repo/status_entry.rb, line 23
def initialize( entryhash )
        @path   = Pathname( entryhash[:path] )
        @source = Pathname( entryhash[:source] ) if entryhash.key?( :source )
        @status = entryhash[ :status ]
end

Public Instance Methods

anchor
inspect()

Return a human-readable representation of the StatusEntry as a String.

# File lib/hglib/repo/status_entry.rb, line 65
def inspect
        return "#<%p:#%x %s: %s%s>" % [
                self.class,
                self.object_id * 2,
                self.path,
                self.status_description,
                self.source ? " via copy/move from #{self.source}" : '',
        ]
end
anchor
status_description()

Return the human-readable status.

# File lib/hglib/repo/status_entry.rb, line 49
def status_description
        return case self.status
                when 'M' then 'modified'
                when 'A' then 'added'
                when 'R' then 'removed'
                when 'C' then 'clean'
                when '!' then 'missing'
                when '?' then 'not tracked'
                when 'I' then 'ignored'
                else
                        raise "unknown status %p" % [ self.status ]
                end
end