Sha256: 48772584949b2bd266d97197a31183f9cb468393d9b7956bed0a8cf5715bde4b

Contents?: true

Size: 956 Bytes

Versions: 5

Compression:

Stored size: 956 Bytes

Contents

namespace :debug do
  command :dirstate do |c|
    c.workflow :hg
    
    c.desc "Shows the current state of the working directory, as amp sees it."
    c.opt :"no-dates", "Do not show modification dates", :short => "-D"
    
    c.on_run do |opts, args|
      repo = opts[:repository]
      showdates = !opts[:"no-dates"]
      time = ""
      
      repo.dirstate.files.sort.each do |file, ent|
        if showdates
          # fuck locales for now....
          timetouse = ent.mtime == -1 ? 0 : ent.mtime
          time = Time.at(timetouse).strftime("%Y-%m-%d %H:%M:%S")
        end
        if ent.mode & 020000 != 0
          mode = 'lnk'
        else
          mode = (ent.mode & 0777).to_s(8)
        end
        Amp::UI.say "#{ent.status}\t#{mode.to_s.rjust(3)} #{ent.size.to_s.rjust(10)} #{time} #{file}"
      end
      
      repo.dirstate.copy_map.each do |key, value|
        Amp::UI.say "copy: #{value} -> #{key}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
amp-0.5.3 lib/amp/commands/commands/workflows/hg/debug/dirstate.rb
amp-0.5.2 lib/amp/commands/commands/workflows/hg/debug/dirstate.rb
amp-0.5.1 lib/amp/commands/commands/workflows/hg/debug/dirstate.rb
amp-pure-0.5.0 lib/amp/commands/commands/workflows/hg/debug/dirstate.rb
amp-0.5.0 lib/amp/commands/commands/workflows/hg/debug/dirstate.rb