class Autobuild::Git::Status

Attributes

common_commit[R]
fetch_commit[R]
head_commit[R]

Public Class Methods

new(status, remote_commit, local_commit, common_commit) click to toggle source
Calls superclass method
# File lib/autobuild/import/git.rb, line 243
def initialize(status, remote_commit, local_commit, common_commit)
    super()
    @status        = status
    @fetch_commit  = fetch_commit
    @head_commit   = head_commit
    @common_commit = common_commit

    if remote_commit != common_commit
        @remote_commits = log(common_commit, remote_commit)
    end
    if local_commit != common_commit
        @local_commits = log(common_commit, local_commit)
    end
end

Public Instance Methods

log(from, to) click to toggle source
# File lib/autobuild/import/git.rb, line 262
def log(from, to)
    log = %xgit log --encoding=UTF-8 --pretty=format:"%h %cr %cn %s" #{from}..#{to}`.chomp

    if log.respond_to?(:encode)
        log = log.encode
    end

    encodings = ['UTF-8', 'iso8859-1']
    begin
        log.split("\n")
    rescue
        if encodings.empty?
            return "[some log messages have invalid characters, cannot display/parse them]"
        end
        log.force_encoding(encodings.pop)
        retry
    end
end
needs_update?() click to toggle source
# File lib/autobuild/import/git.rb, line 258
def needs_update?
    status == Status::NEEDS_MERGE || status == Status::SIMPLE_UPDATE
end