Class: PVN::Diff::StatusPaths

Inherits:
Paths
  • Object
show all
Includes:
Logue::Loggable
Defined in:
lib/pvn/diff/status_paths.rb

Instance Method Summary collapse

Methods inherited from Paths

#[], #each, #initialize, #size, #to_map

Constructor Details

This class inherits a constructor from PVN::Diff::Paths

Instance Method Details

#add(elmt, url) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/pvn/diff/status_paths.rb', line 21

def add elmt, url
  status = elmt.find_files_by_status
  info "status: #{status}".color('#33facc')
  status.entries.each do |entry|
    info "entry: #{entry}".color('#33facc')
    # we don't care about unversioned entries for diffing.
    info "entry.status: #{entry.status}".color('#33facc')
    info "entry.status.class: #{entry.status.class}".color('#33facc')
    next if entry.status.unversioned?
    
    # svn log prepends /; svn status does not
    # name = '/' + entry.path
    # rev = :working_copy

    # what Status::Entry calls a status, we call an action, unifying it with
    # svn log representation.
    # action = entry.status

    info "entry.status_revision: #{entry.status_revision}"
    path = LocalPath.new entry
    @elements << path
  end
end

#add_for_path(path) ⇒ Object



14
15
16
17
18
19
# File 'lib/pvn/diff/status_paths.rb', line 14

def add_for_path path
  pathelmt = PVN::IO::Element.new :local => path
  pathinfo = pathelmt.get_info
  elmt = PVN::IO::Element.new :local => path
  add elmt, pathinfo.url
end

#get_status_revisions(status_entry) ⇒ Object

$$$ this may belong in Status::Entry



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pvn/diff/status_paths.rb', line 46

def get_status_revisions status_entry
  # the printing revision in svn (svn diff -r20) are confusing, but this
  # is what it looks like:

  # if a file is modified,
  #     if the file existed at fromrev
  #         it is compared with fromrev
  #     else
  #         it is compared to BASE

  info "status_entry.status: #{status_entry.status}".color('#2c2cdd')

  action = SVNx::Action.new status_entry.status
  info "action: #{action}".color('#2c2cdd')
  case
  when action.added?
    info "added"
    [ 0, 0 ]
  when action.deleted?
    info "deleted"
    [ @revision.from, :working_copy ]
  when action.modified?
    info "modified"
    [ status_entry.status_revision, :working_copy ]
  end
end