Sha256: 67a5957bc93d74988d130263d4a9c32d8401884f48726413edf7510d57d56bd8

Contents?: true

Size: 1.7 KB

Versions: 27

Compression:

Stored size: 1.7 KB

Contents

require 'autoproj/cli/base'

module Autoproj
    module CLI
        class Log < Base
            def run(args, options = Hash.new)
                ws.load_config

                if !ws.config.import_log_enabled?
                    Autoproj.error "import log is disabled on this install"
                    return
                elsif !Ops::Snapshot.update_log_available?(ws.manifest)
                    Autoproj.error "import log is not available on this install, the main build configuration repository is not using git"
                    return
                end

                common_args = [Autobuild.tool(:git), "--git-dir=#{ws.config_dir}/.git"]
                if since = options[:since]
                    exec(*common_args, 'diff', parse_log_entry(since), 'autoproj@{0}')
                elsif args.empty?
                    exec(*common_args, 'reflog',
                        Ops::Snapshot.import_state_log_ref, '--format=%Cgreen%gd %Cblue%cr %Creset%gs')
                elsif options[:diff]
                    exec(*common_args, 'diff', *args.map { |entry| parse_log_entry(entry) })
                else
                    exec(*common_args, 'show', *args.map { |entry| parse_log_entry(entry) })
                end
            end

            def parse_log_entry(entry)
                if entry =~ /^autoproj@{\d+}$/
                    entry
                elsif entry =~ /^\d+$/
                    "autoproj@{#{entry}}"
                else
                    raise CLIInvalidArguments, "unexpected revision name '#{entry}', expected either autoproj@{ID} or ID ('ID' being a number). Run 'autoproj log' without arguments for a list of known entries"
                end
            end
        end
    end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
autoproj-2.14.0 lib/autoproj/cli/log.rb
autoproj-2.13.0 lib/autoproj/cli/log.rb
autoproj-2.12.1 lib/autoproj/cli/log.rb
autoproj-2.12.0 lib/autoproj/cli/log.rb
autoproj-2.11.0 lib/autoproj/cli/log.rb
autoproj-2.10.2 lib/autoproj/cli/log.rb
autoproj-2.10.1 lib/autoproj/cli/log.rb
autoproj-2.10.0 lib/autoproj/cli/log.rb
autoproj-2.9.0 lib/autoproj/cli/log.rb
autoproj-2.8.8 lib/autoproj/cli/log.rb
autoproj-2.8.7 lib/autoproj/cli/log.rb
autoproj-2.8.6 lib/autoproj/cli/log.rb
autoproj-2.8.5 lib/autoproj/cli/log.rb
autoproj-2.8.5.b1 lib/autoproj/cli/log.rb
autoproj-2.8.4 lib/autoproj/cli/log.rb
autoproj-2.8.3 lib/autoproj/cli/log.rb
autoproj-2.8.2 lib/autoproj/cli/log.rb
autoproj-2.8.1 lib/autoproj/cli/log.rb
autoproj-2.8.0 lib/autoproj/cli/log.rb
autoproj-2.7.1 lib/autoproj/cli/log.rb