Class: PVN::Diff::LocalPath
- Inherits:
-
Path
- Object
- Path
- PVN::Diff::LocalPath
show all
- Defined in:
- lib/pvn/diff/local_path.rb
Instance Attribute Summary
Attributes inherited from Path
#changes, #name, #url
Instance Method Summary
collapse
Methods inherited from Path
#add_change, #run_diff, #run_diff_command, #to_revision, #to_revision_string, #to_s
Constructor Details
#initialize(entry) ⇒ LocalPath
10
11
12
13
14
15
16
17
|
# File 'lib/pvn/diff/local_path.rb', line 10
def initialize entry
@entry = entry
@elmt = create_element
name = entry.path
action = SVNx::Action.new @entry.status
revision = action.added? ? 0 : @elmt.get_info.revision
super name, revision, action, nil
end
|
Instance Method Details
#create_element ⇒ Object
40
41
42
|
# File 'lib/pvn/diff/local_path.rb', line 40
def create_element
PVN::IO::Element.new :local => @entry.path
end
|
#get_latest_revision ⇒ Object
44
45
46
47
|
# File 'lib/pvn/diff/local_path.rb', line 44
def get_latest_revision
svninfo = @elmt.get_info
svninfo.revision
end
|
#read_working_copy ⇒ Object
35
36
37
38
|
# File 'lib/pvn/diff/local_path.rb', line 35
def read_working_copy
pn = Pathname.new @entry.path
pn.readlines
end
|
#show_as_added ⇒ Object
49
50
51
52
53
|
# File 'lib/pvn/diff/local_path.rb', line 49
def show_as_added
fromlines = nil
tolines = read_working_copy
run_diff @entry.path, fromlines, 0, tolines, 0, nil
end
|
#show_as_deleted ⇒ Object
55
56
57
58
59
60
|
# File 'lib/pvn/diff/local_path.rb', line 55
def show_as_deleted
fromrev = changes[0].revision
lines = @elmt.cat nil, false
run_diff @entry.path, lines, fromrev, nil, nil, nil
end
|
#show_as_modified(whitespace) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/pvn/diff/local_path.rb', line 62
def show_as_modified whitespace
remotelines = @elmt.cat nil, false
fromrev = changes[0].revision
wclines = read_working_copy
run_diff @entry.path, remotelines, fromrev, wclines, nil, whitespace
end
|
#show_diff(whitespace = nil) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/pvn/diff/local_path.rb', line 19
def show_diff whitespace = nil
case @entry.status
when 'modified'
show_as_modified whitespace
when 'deleted'
show_as_deleted
when 'added'
show_as_added
end
end
|
#use_cache? ⇒ Boolean
$$$ todo: integrate these, from old diff/diffcmd
31
32
33
|
# File 'lib/pvn/diff/local_path.rb', line 31
def use_cache?
super && !against_head?
end
|