Module: SvnColours
- Included in:
- TreeViewer
- Defined in:
- lib/hilfer/svn_colours.rb
Overview
This does a simple svn status (not going to the server)
and returns colouring for various statuses
Instance Method Summary collapse
Instance Method Details
#compute_colours(dir_path) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/hilfer/svn_colours.rb', line 35 def compute_colours( dir_path ) path_colours = {} begin # args are # path # rev=nil ed 'HEAD' # recurse=true # get_all=false # update=true # no_ignore=false # ignore_externals=false # don't go to the server # status is an instance of Svn_wc_status2_t context.status( dir_path, nil, false, true, false ) do |path,status| path_colours[path] = status_colours[status.text_status] end rescue # mainly to catch exceptions from non-svn directories end path_colours end |
#context ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/hilfer/svn_colours.rb', line 27 def context if @context.nil? @context = Svn::Client::Context.new @context.add_simple_provider{|x| } end @context end |
#status_colours ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hilfer/svn_colours.rb', line 8 def status_colours @status_colours ||= { Svn::Wc::STATUS_NONE => '#000', # black Svn::Wc::STATUS_NORMAL => '#000', # black Svn::Wc::STATUS_ADDED => '#080', # green Svn::Wc::STATUS_MISSING => '#f00', # red Svn::Wc::STATUS_INCOMPLETE => '#f00', # red Svn::Wc::STATUS_DELETED => '#000', # black Svn::Wc::STATUS_REPLACED => '#000', # black Svn::Wc::STATUS_MODIFIED => '#008', # dark blue Svn::Wc::STATUS_MERGED => '#000', # black Svn::Wc::STATUS_CONFLICTED => '#f00', # red Svn::Wc::STATUS_OBSTRUCTED => '#f00', # red Svn::Wc::STATUS_IGNORED => '#880', # brown Svn::Wc::STATUS_EXTERNAL => '#000', # black Svn::Wc::STATUS_UNVERSIONED => '#808', # purple } end |