pvn 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/change.rb +50 -0
- data/bin/pvn +8 -4
- data/bin/quote.rb +18 -6
- data/bin/quotes.orig.txt +145 -0
- data/bin/quotes.txt +64 -0
- data/lib/pvn/app/runner.rb +103 -0
- data/lib/pvn/app.rb +1 -142
- data/lib/pvn/{subcommands/base → command}/color_option.rb +1 -1
- data/lib/pvn/{subcommands/base → command}/command.rb +10 -6
- data/lib/pvn/{subcommands/base → command}/doc.rb +2 -2
- data/lib/pvn/{subcommands/base → command}/options.rb +2 -2
- data/lib/pvn/config.rb +14 -1
- data/lib/pvn/{subcommands/diff → diff}/command.rb +6 -6
- data/lib/pvn/diff/differ.rb +60 -44
- data/lib/pvn/diff/local_differ.rb +99 -0
- data/lib/pvn/diff/log_paths.rb +46 -0
- data/lib/pvn/{subcommands/diff → diff}/options.rb +8 -6
- data/lib/pvn/diff/path.rb +52 -0
- data/lib/pvn/diff/path_revision.rb +31 -0
- data/lib/pvn/diff/paths.rb +42 -0
- data/lib/pvn/diff/repository_differ.rb +154 -0
- data/lib/pvn/diff/revision.rb +36 -0
- data/lib/pvn/diff/status_paths.rb +87 -0
- data/lib/pvn/io/element.rb +29 -8
- data/lib/pvn/{subcommands/log → log}/command.rb +4 -4
- data/lib/pvn/log/formatter/log_formatter.rb +1 -1
- data/lib/pvn/{subcommands/log → log}/options.rb +7 -7
- data/lib/pvn/{subcommands/pct → pct}/command.rb +6 -6
- data/lib/pvn/{subcommands/pct → pct}/diffcount.rb +1 -1
- data/lib/pvn/{subcommands/pct → pct}/differ.rb +2 -2
- data/lib/pvn/{subcommands/pct → pct}/local_differ.rb +3 -3
- data/lib/pvn/pct/options.rb +12 -0
- data/lib/pvn/{subcommands/pct → pct}/repository_differ.rb +5 -13
- data/lib/pvn/revision/{entry.rb → argument.rb} +45 -30
- data/lib/pvn/{subcommands/revision → revision}/base_option.rb +2 -2
- data/lib/pvn/revision/error.rb +11 -0
- data/lib/pvn/{subcommands/revision → revision}/multiple_revisions_option.rb +1 -1
- data/lib/pvn/revision/range.rb +49 -0
- data/lib/pvn/{subcommands/revision → revision}/revision_option.rb +1 -8
- data/lib/pvn/{subcommands/revision → revision}/revision_regexp_option.rb +2 -2
- data/lib/pvn/{subcommands/status → status}/command.rb +6 -6
- data/lib/pvn/status/formatter/status_formatter.rb +1 -1
- data/lib/pvn/status/options.rb +12 -0
- data/lib/pvn/{base/util.rb → util/array.rb} +2 -1
- data/lib/pvn.rb +1 -6
- data/lib/svnx/action.rb +52 -0
- data/lib/svnx/entries.rb +9 -1
- data/lib/svnx/log/command.rb +4 -3
- data/lib/svnx/status/entry.rb +30 -13
- data/lib/synoption/base_option.rb +10 -27
- data/lib/synoption/matchers.rb +22 -0
- data/lib/system/command/cachefile.rb +28 -14
- data/lib/system/command.rb +1 -1
- data/test/integration/pvn/diff/command_test.rb +20 -0
- data/test/integration/pvn/diff/local_differ_test.rb +72 -0
- data/test/integration/pvn/diff/log_paths_test.rb +28 -0
- data/test/integration/pvn/diff/repository_differ_test.rb +127 -0
- data/test/integration/pvn/diff/status_paths_test.rb +31 -0
- data/test/integration/pvn/log/command_test.rb +29 -0
- data/test/integration/pvn/pct/command_test.rb +30 -0
- data/test/integration/pvn/status/command_test.rb +26 -0
- data/test/unit/pvn/app_test.rb +7 -5
- data/test/unit/pvn/diff/path_revision_test.rb +45 -0
- data/test/unit/pvn/diff/path_test.rb +38 -0
- data/test/unit/pvn/diff/revision_test.rb +35 -0
- data/test/unit/pvn/io/element/log/log_test.rb +2 -2
- data/test/unit/pvn/log/formatter/entry_formatter_test.rb +40 -29
- data/test/unit/pvn/{subcommands/log → log}/options_test.rb +4 -4
- data/test/unit/pvn/revision/argument_test.rb +157 -0
- data/test/unit/pvn/{subcommands/revision → revision}/multiple_revisions_option_test.rb +10 -11
- data/test/unit/pvn/revision/range_test.rb +26 -0
- data/test/unit/pvn/{subcommands/revision → revision}/revision_option_test.rb +13 -18
- data/test/unit/pvn/{subcommands/revision → revision}/revision_regexp_option_test.rb +8 -10
- data/test/unit/svnx/action_test.rb +67 -0
- data/test/unit/svnx/info/entries_test.rb +10 -10
- data/test/unit/svnx/info/entry_test.rb +7 -10
- data/test/unit/svnx/log/entries_test.rb +31 -29
- data/test/unit/svnx/log/entry_test.rb +3 -7
- data/test/unit/svnx/status/entries_test.rb +7 -6
- data/test/unit/svnx/status/entry_test.rb +2 -23
- data/test/unit/system/command/cachefile_test.rb +53 -0
- data/test/unit/system/command/caching_test.rb +14 -23
- metadata +83 -64
- data/lib/pvn/describe.rb +0 -40
- data/lib/pvn/diff/diffcmd.rb +0 -49
- data/lib/pvn/diff/diffopts.rb +0 -58
- data/lib/pvn/log/logcmd.rb +0 -135
- data/lib/pvn/log/logentry.rb +0 -116
- data/lib/pvn/log/logfactory.rb +0 -101
- data/lib/pvn/log/logoptions.rb +0 -43
- data/lib/pvn/revision.rb +0 -119
- data/lib/pvn/subcommands/diff/differ.rb +0 -65
- data/lib/pvn/subcommands/diff/local_differ.rb +0 -103
- data/lib/pvn/subcommands/diff/repository_differ.rb +0 -145
- data/lib/pvn/subcommands/pct/clargs.rb +0 -33
- data/lib/pvn/subcommands/pct/options.rb +0 -12
- data/lib/pvn/subcommands/status/options.rb +0 -12
- data/lib/pvn/svn/command/svncmd.rb +0 -39
- data/lib/pvn/svn/environment.rb +0 -23
- data/lib/pvn/svn/svnelement.rb +0 -89
- data/lib/pvn/svn/svninfo.rb +0 -42
- data/lib/pvn/svn/svnroot.rb +0 -29
- data/lib/pvn/upp/uppcmd.rb +0 -112
- data/lib/pvn/wherecmd.rb +0 -55
- data/test/integration/pvn/subcommands/diff/command_test.rb +0 -153
- data/test/integration/pvn/subcommands/log/command_test.rb +0 -22
- data/test/integration/svnx/log/test.rb +0 -43
- data/test/unit/pvn/revision/entry_test.rb +0 -110
- /data/lib/pvn/{subcommands/base → command}/clargs.rb +0 -0
- /data/lib/pvn/{base → util}/color_formatter.rb +0 -0
- /data/lib/pvn/{base → util}/textlines.rb +0 -0
data/lib/pvn/log/logfactory.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'riel'
|
6
|
-
require 'pvn/log/logentry'
|
7
|
-
require 'pvn/base/textlines'
|
8
|
-
|
9
|
-
module PVN; module Log; end; end
|
10
|
-
|
11
|
-
module PVN;;Log
|
12
|
-
SVN_LOG_SUMMARY_LINE_RE = Regexp.new('^r(\d+) \| (\S+) \| (\S+) (\S+) (\S+) \((.*)\) \| (\d+) lines?$')
|
13
|
-
SVN_LOG_SEPARATOR_LINE_RE = Regexp.new('^-{72}$')
|
14
|
-
SVN_LOG_VERBOSE_START_RE = Regexp.new('^Changed paths:$')
|
15
|
-
SVN_LOG_FILE_NAME_RE = Regexp.new('^ (\w) (.*)$')
|
16
|
-
|
17
|
-
class TextFactory
|
18
|
-
include Loggable
|
19
|
-
|
20
|
-
def initialize lines
|
21
|
-
@textlines = TextLines.new lines
|
22
|
-
@entries = nil
|
23
|
-
end
|
24
|
-
|
25
|
-
def entries
|
26
|
-
@entries ||= read_entries
|
27
|
-
end
|
28
|
-
|
29
|
-
def read_entries
|
30
|
-
entries = Array.new
|
31
|
-
while entry = create_next_entry
|
32
|
-
entries << entry
|
33
|
-
end
|
34
|
-
entries
|
35
|
-
end
|
36
|
-
|
37
|
-
def match_line re, offset = 0
|
38
|
-
@textlines.match_line re, offset
|
39
|
-
end
|
40
|
-
|
41
|
-
def advance_line nlines = 1
|
42
|
-
@textlines.advance_line nlines
|
43
|
-
end
|
44
|
-
|
45
|
-
def match_log_start_line
|
46
|
-
match_line(SVN_LOG_SEPARATOR_LINE_RE) && match_line(SVN_LOG_SUMMARY_LINE_RE, 1)
|
47
|
-
end
|
48
|
-
|
49
|
-
def has_line?
|
50
|
-
@textlines.has_line?
|
51
|
-
end
|
52
|
-
|
53
|
-
def current_line
|
54
|
-
@textlines.line
|
55
|
-
end
|
56
|
-
|
57
|
-
def read_comment
|
58
|
-
comment = Array.new
|
59
|
-
while has_line? && !match_line(SVN_LOG_SEPARATOR_LINE_RE)
|
60
|
-
comment << current_line.chomp
|
61
|
-
advance_line
|
62
|
-
end
|
63
|
-
comment
|
64
|
-
end
|
65
|
-
|
66
|
-
def read_files
|
67
|
-
advance_line
|
68
|
-
files = Array.new
|
69
|
-
while (ln = current_line) && !ln.strip.empty?
|
70
|
-
md = match_line(SVN_LOG_FILE_NAME_RE)
|
71
|
-
changetype = md[1]
|
72
|
-
fname = md[2]
|
73
|
-
files << fname
|
74
|
-
advance_line
|
75
|
-
end
|
76
|
-
files
|
77
|
-
end
|
78
|
-
|
79
|
-
def create_entry fielddata
|
80
|
-
advance_line 2
|
81
|
-
fields = Hash[Entry::FIELDS.zip fielddata[1 .. -1]]
|
82
|
-
if match_line SVN_LOG_VERBOSE_START_RE
|
83
|
-
fields[:files] = read_files
|
84
|
-
end
|
85
|
-
advance_line
|
86
|
-
fields[:comment] = read_comment
|
87
|
-
return Entry.new fields
|
88
|
-
end
|
89
|
-
|
90
|
-
def create_next_entry
|
91
|
-
while has_line?
|
92
|
-
if fielddata = match_log_start_line
|
93
|
-
return create_entry fielddata
|
94
|
-
else
|
95
|
-
advance_line
|
96
|
-
end
|
97
|
-
end
|
98
|
-
nil
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
data/lib/pvn/log/logoptions.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'synoption/set'
|
5
|
-
require 'synoption/option'
|
6
|
-
require 'synoption/boolean_option'
|
7
|
-
require 'pvn/subcommands/revision/revision_regexp_option'
|
8
|
-
|
9
|
-
module PVN
|
10
|
-
DEFAULT_LIMIT = 5
|
11
|
-
|
12
|
-
class LimitOption < Option
|
13
|
-
def initialize lmtargs = Hash.new
|
14
|
-
super :limit, '-l', "the number of log entries", DEFAULT_LIMIT, :negate => [ %r{^--no-?limit} ]
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class VerboseOption < BooleanOption
|
19
|
-
def initialize optargs = Hash.new
|
20
|
-
super :verbose, '-v', [ "include the files in the change" ], false
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class FormatOption < BooleanOption
|
25
|
-
def initialize optargs = Hash.new
|
26
|
-
super :format, '-f', "use the custom (colorized) format", true, :negate => [ '-F', %r{^--no-?format} ], :as_cmdline_option => nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class LogOptionSet < OptionSet
|
31
|
-
attr_accessor :revision
|
32
|
-
attr_reader :format
|
33
|
-
|
34
|
-
def initialize
|
35
|
-
super
|
36
|
-
|
37
|
-
add LimitOption.new
|
38
|
-
@revision = add RevisionRegexpOption.new(:unsets => :limit)
|
39
|
-
@verbose = add VerboseOption.new
|
40
|
-
@format = add FormatOption.new
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/pvn/revision.rb
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'riel'
|
6
|
-
require 'pvn/log/logcmd'
|
7
|
-
|
8
|
-
module PVN
|
9
|
-
# Returns the Nth revision from the given logging output.
|
10
|
-
|
11
|
-
# -n means to count from the end of the list.
|
12
|
-
# +n means to count from the beginning of the list.
|
13
|
-
# n means the literal revision number.
|
14
|
-
class Revision
|
15
|
-
include Loggable
|
16
|
-
|
17
|
-
DATE_REGEXP = Regexp.new('^\{(.*?)\}')
|
18
|
-
SVN_REVISION_WORDS = %w{ HEAD BASE COMMITTED PREV }
|
19
|
-
|
20
|
-
def self.revision_from_args optset, optargs
|
21
|
-
revarg = optargs.shift
|
22
|
-
RIEL::Log.debug "revarg: #{revarg}"
|
23
|
-
RIEL::Log.debug "optargs: #{optargs}"
|
24
|
-
|
25
|
-
rev = Revision.new(:fname => optset.arguments[0], :value => revarg, :use_cache => false).revision
|
26
|
-
RIEL::Log.debug "rev: #{rev}"
|
27
|
-
|
28
|
-
if rev.nil?
|
29
|
-
raise ArgumentError.new "invalid revision: #{revarg} on #{optargs[-1]}"
|
30
|
-
end
|
31
|
-
rev
|
32
|
-
end
|
33
|
-
|
34
|
-
attr_reader :revision
|
35
|
-
|
36
|
-
def initialize args = Hash.new
|
37
|
-
debug "args : #{args}".yellow
|
38
|
-
value = args[:value]
|
39
|
-
num = value.kind_of?(String) ? value.strip : value
|
40
|
-
debug "num : #{num}".yellow
|
41
|
-
@fname = args[:fname]
|
42
|
-
debug "fname : #{@fname}".yellow
|
43
|
-
|
44
|
-
@revision = nil
|
45
|
-
|
46
|
-
from, to = num.kind_of?(String) ? num.split(':') : num
|
47
|
-
info "from: #{from}; to: #{to}".on_blue
|
48
|
-
info "from: #{from.class}; to: #{to.class}".on_blue
|
49
|
-
|
50
|
-
@revision = convert_to_revision from
|
51
|
-
if to
|
52
|
-
@revision += ':' + convert_to_revision(to)
|
53
|
-
end
|
54
|
-
|
55
|
-
info "@revision: #{@revision}; #{@revision.class}"
|
56
|
-
end
|
57
|
-
|
58
|
-
def to_s
|
59
|
-
@revision
|
60
|
-
end
|
61
|
-
|
62
|
-
def convert_to_revision arg
|
63
|
-
if SVN_REVISION_WORDS.include? arg
|
64
|
-
info "word: #{arg}"
|
65
|
-
arg
|
66
|
-
elsif neg = Integer.negative?(arg)
|
67
|
-
info "neg: #{arg}"
|
68
|
-
get_negative_revision neg
|
69
|
-
elsif arg.kind_of? Fixnum
|
70
|
-
info "fixnum: #{arg}"
|
71
|
-
arg.to_s
|
72
|
-
elsif md = DATE_REGEXP.match(arg)
|
73
|
-
info "md: #{md.inspect}".on_red
|
74
|
-
md[0]
|
75
|
-
elsif md = %r{^\+(\d+)}.match(arg)
|
76
|
-
arg = md[1].to_i
|
77
|
-
debug "arg: #{arg}"
|
78
|
-
get_revision @fname, nil, arg
|
79
|
-
else
|
80
|
-
arg.to_s
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def get_negative_revision neg
|
85
|
-
debug "neg : #{neg}"
|
86
|
-
|
87
|
-
# if these two are the same number (revision(-3) == revision(-2)) then
|
88
|
-
# we're at the end/beginning of the list.
|
89
|
-
currrev = get_negative_revision_unchecked neg
|
90
|
-
if neg == -1
|
91
|
-
debug "currrev: #{currrev}"
|
92
|
-
@revision = currrev
|
93
|
-
else
|
94
|
-
debug "neg : #{neg}"
|
95
|
-
prevrev = get_negative_revision_unchecked neg + 1
|
96
|
-
|
97
|
-
debug "prevrev: #{prevrev}"
|
98
|
-
debug "currrev: #{currrev}"
|
99
|
-
|
100
|
-
# $$$ does -r 123 -l 2 == -r 123 -l 3?
|
101
|
-
@revision = prevrev == currrev ? nil : currrev
|
102
|
-
# @revision = prevrev == currrev ? currrev : currrev
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def get_negative_revision_unchecked neg
|
107
|
-
# count the limit backward, and get the "first" (last) match
|
108
|
-
limit = -1 * neg
|
109
|
-
get_revision @fname, limit, 1
|
110
|
-
end
|
111
|
-
|
112
|
-
def get_revision fname, limit, num
|
113
|
-
logcmd = LogCommand.new :limit => limit, :command_args => [ fname ]
|
114
|
-
entries = logcmd.entries
|
115
|
-
entry = entries[-1 * num]
|
116
|
-
entry && entry.revision.to_i
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'pvn/io/element'
|
5
|
-
require 'pvn/subcommands/diff/options'
|
6
|
-
require 'pvn/subcommands/base/command'
|
7
|
-
require 'tempfile'
|
8
|
-
|
9
|
-
$io = $stdout
|
10
|
-
|
11
|
-
module PVN::Subcommands::Diff
|
12
|
-
class Differ
|
13
|
-
include Loggable
|
14
|
-
|
15
|
-
attr_reader :whitespace
|
16
|
-
attr_reader :revision
|
17
|
-
|
18
|
-
def initialize options
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_revision_string rev
|
22
|
-
rev ? "revision #{rev}" : "working copy"
|
23
|
-
end
|
24
|
-
|
25
|
-
def write_to_temp entry, lines
|
26
|
-
Tempfile.open('pvn') do |to|
|
27
|
-
topath = to.path
|
28
|
-
info "topath: #{topath}"
|
29
|
-
to.puts lines
|
30
|
-
to.close
|
31
|
-
cmd = "diff -u"
|
32
|
-
label = " -L '#{entry.path} (revision 0)'"
|
33
|
-
2.times do
|
34
|
-
cmd << label
|
35
|
-
end
|
36
|
-
cmd << " #{frpath}"
|
37
|
-
cmd << " #{entry.path}"
|
38
|
-
IO.popen(cmd) do |io|
|
39
|
-
puts io.readlines
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def run_diff_command entry, fromrev, torev, frompath, topath
|
45
|
-
info "whitespace: #{whitespace}"
|
46
|
-
|
47
|
-
cmd = "diff -u"
|
48
|
-
if whitespace
|
49
|
-
cmd << " -x -b -x -w -x --ignore-eol-style"
|
50
|
-
end
|
51
|
-
|
52
|
-
[ fromrev, torev ].each do |rev|
|
53
|
-
revstr = to_revision_string rev
|
54
|
-
cmd << " -L '#{entry.path}\t(#{revstr})'"
|
55
|
-
end
|
56
|
-
cmd << " #{frompath}"
|
57
|
-
cmd << " #{topath}"
|
58
|
-
$io.puts "Index: #{entry.path}"
|
59
|
-
$io.puts "==================================================================="
|
60
|
-
IO.popen(cmd) do |io|
|
61
|
-
$io.puts io.readlines
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'pvn/io/element'
|
5
|
-
require 'pvn/subcommands/diff/options'
|
6
|
-
require 'tempfile'
|
7
|
-
require 'pvn/subcommands/diff/differ'
|
8
|
-
|
9
|
-
module PVN::Subcommands::Diff
|
10
|
-
class LocalDiffer < Differ
|
11
|
-
def initialize options
|
12
|
-
super
|
13
|
-
|
14
|
-
paths = options.paths
|
15
|
-
paths = %w{ . } if paths.empty?
|
16
|
-
|
17
|
-
info "paths: #{paths}".yellow
|
18
|
-
|
19
|
-
allentries = Array.new
|
20
|
-
|
21
|
-
# we sort only the sub-entries, so the order in which paths were specified is preserved
|
22
|
-
|
23
|
-
@whitespace = options.whitespace
|
24
|
-
|
25
|
-
paths.each do |path|
|
26
|
-
info "path: #{path}".red
|
27
|
-
elmt = PVN::IO::Element.new :local => path
|
28
|
-
entries = elmt.find_files_by_status
|
29
|
-
|
30
|
-
allentries.concat entries.sort_by { |n| n.path }
|
31
|
-
end
|
32
|
-
|
33
|
-
info "allentries: #{allentries}"
|
34
|
-
|
35
|
-
allentries.each do |entry|
|
36
|
-
info "entry: #{entry.inspect}".on_blue
|
37
|
-
case entry.status
|
38
|
-
when 'modified'
|
39
|
-
show_as_modified entry
|
40
|
-
when 'deleted'
|
41
|
-
show_as_deleted entry
|
42
|
-
when 'added'
|
43
|
-
show_as_added entry
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def read_working_copy entry
|
49
|
-
pn = Pathname.new entry.path
|
50
|
-
pn.readlines
|
51
|
-
end
|
52
|
-
|
53
|
-
def show_as_added entry
|
54
|
-
Tempfile.open('pvn') do |from|
|
55
|
-
# from is an empty file
|
56
|
-
from.close
|
57
|
-
|
58
|
-
# I think this is always revision 0
|
59
|
-
run_diff_command entry, 0, 0, from.path, entry.path
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def show_as_deleted entry
|
64
|
-
elmt = PVN::IO::Element.new :local => entry.path
|
65
|
-
|
66
|
-
svninfo = elmt.get_info
|
67
|
-
lines = elmt.cat_remote
|
68
|
-
|
69
|
-
Tempfile.open('pvn') do |from|
|
70
|
-
from.puts lines
|
71
|
-
from.close
|
72
|
-
Tempfile.open('pvn') do |to|
|
73
|
-
# to is an empty file
|
74
|
-
to.close
|
75
|
-
run_diff_command entry, svninfo.revision, nil, from.path, to.path
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def show_as_modified entry
|
81
|
-
# only doing working copy to remote now
|
82
|
-
elmt = PVN::IO::Element.new :local => entry.path
|
83
|
-
|
84
|
-
svninfo = elmt.get_info
|
85
|
-
remotelines = elmt.cat_remote
|
86
|
-
|
87
|
-
fromrev = svninfo.revision
|
88
|
-
torev = nil # AKA working copy
|
89
|
-
|
90
|
-
wclines = read_working_copy entry
|
91
|
-
|
92
|
-
Tempfile.open('pvn') do |from|
|
93
|
-
from.puts remotelines
|
94
|
-
from.close
|
95
|
-
Tempfile.open('pvn') do |to|
|
96
|
-
to.puts wclines
|
97
|
-
to.close
|
98
|
-
run_diff_command entry, fromrev, torev, from.path, to.path
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'pvn/io/element'
|
5
|
-
require 'pvn/subcommands/diff/options'
|
6
|
-
require 'tempfile'
|
7
|
-
require 'pvn/subcommands/diff/differ'
|
8
|
-
|
9
|
-
module PVN::Subcommands::Diff
|
10
|
-
# this will replace RevisionEntry
|
11
|
-
class Revision
|
12
|
-
include Loggable
|
13
|
-
|
14
|
-
attr_reader :value
|
15
|
-
attr_reader :from
|
16
|
-
attr_reader :to
|
17
|
-
|
18
|
-
def initialize from, to = nil
|
19
|
-
if to
|
20
|
-
@from = from
|
21
|
-
@to = to
|
22
|
-
else
|
23
|
-
@from, @to = from.split(':')
|
24
|
-
end
|
25
|
-
info "@from: #{@from}"
|
26
|
-
info "@to: #{@to}"
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_s
|
30
|
-
str = @from.to_s
|
31
|
-
if @to
|
32
|
-
str << ':' << @to.to_s
|
33
|
-
end
|
34
|
-
str
|
35
|
-
end
|
36
|
-
|
37
|
-
def head?
|
38
|
-
@to == nil
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class RepositoryDiffer < Differ
|
43
|
-
include Loggable
|
44
|
-
|
45
|
-
attr_reader :whitespace
|
46
|
-
attr_reader :revision
|
47
|
-
|
48
|
-
def initialize options
|
49
|
-
paths = options.paths
|
50
|
-
paths = %w{ . } if paths.empty?
|
51
|
-
|
52
|
-
info "paths: #{paths}"
|
53
|
-
|
54
|
-
allentries = Array.new
|
55
|
-
|
56
|
-
# we sort only the sub-entries, so the order in which paths were specified is preserved
|
57
|
-
|
58
|
-
@whitespace = options.whitespace
|
59
|
-
rev = options.revision
|
60
|
-
change = options.change
|
61
|
-
info "change: #{change}"
|
62
|
-
info "rev: #{rev}"
|
63
|
-
info "rev: #{rev.class}"
|
64
|
-
|
65
|
-
if change
|
66
|
-
@revision = Revision.new(change.to_i - 1, change.to_i)
|
67
|
-
elsif rev.kind_of?(Array)
|
68
|
-
if rev.size == 2
|
69
|
-
# this is some contorting, since -rx:y does not mean comparing the files
|
70
|
-
# in changelist x; it means all the entries from x+1 through y, inclusive.
|
71
|
-
|
72
|
-
### $$$ this doesn't handle dates:
|
73
|
-
@revision = Revision.new(rev[0].to_i + 1, rev[0].to_i)
|
74
|
-
else
|
75
|
-
from, to = rev[0].split(':')
|
76
|
-
@revision = Revision.new(from.to_i + 1, to)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
info "revision: #{@revision}; #{@revision.class}".on_blue
|
81
|
-
|
82
|
-
# maps from pathnames to { :first, :last } revision updated.
|
83
|
-
paths_to_revisions = Hash.new
|
84
|
-
|
85
|
-
paths.each do |path|
|
86
|
-
logentries = get_log_entries path, @revision
|
87
|
-
logentries.each do |logentry|
|
88
|
-
info "logentry: #{logentry}".yellow
|
89
|
-
info "logentry.revision: #{logentry.revision}".yellow
|
90
|
-
info "logentry.paths: #{logentry.paths}".yellow
|
91
|
-
|
92
|
-
# should add the revision to this, so we know which is the first
|
93
|
-
# version to compare against the last:
|
94
|
-
|
95
|
-
logentry.paths.each do |lp|
|
96
|
-
info "lp: #{lp.inspect}".cyan
|
97
|
-
allentries << { :path => lp, :revision => logentry.revision }
|
98
|
-
rec = paths_to_revisions[lp.name]
|
99
|
-
if rec
|
100
|
-
rec[:last] = logentry.revision
|
101
|
-
else
|
102
|
-
rec = { :first => logentry.revision, :action => lp.action }
|
103
|
-
end
|
104
|
-
paths_to_revisions[lp.name] = rec
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
paths_to_revisions.sort.each do |name, revisions|
|
110
|
-
puts "name: #{name}"
|
111
|
-
puts "revisions: #{revisions}"
|
112
|
-
end
|
113
|
-
|
114
|
-
info "allentries: #{allentries}"
|
115
|
-
|
116
|
-
allentries.each do |entry|
|
117
|
-
info "entry: #{entry.inspect}".on_blue
|
118
|
-
next if true
|
119
|
-
case entry.status
|
120
|
-
when 'modified'
|
121
|
-
show_as_modified entry
|
122
|
-
when 'deleted'
|
123
|
-
show_as_deleted entry
|
124
|
-
when 'added'
|
125
|
-
show_as_added entry
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def get_log_entries path, revision
|
131
|
-
cmdargs = Hash.new
|
132
|
-
cmdargs[:path] = path
|
133
|
-
cmdargs[:revision] = revision.to_s
|
134
|
-
cmdargs[:verbose] = true
|
135
|
-
|
136
|
-
# should be conditional on revision:
|
137
|
-
cmdargs[:use_cache] = false
|
138
|
-
|
139
|
-
logargs = SVNx::LogCommandArgs.new cmdargs
|
140
|
-
elmt = PVN::IO::Element.new :local => path
|
141
|
-
log = elmt.log logargs
|
142
|
-
entries = log.entries
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'riel'
|
6
|
-
require 'pvn/subcommand/base/clargs'
|
7
|
-
|
8
|
-
module PVN; module App; module Pct; end; end; end
|
9
|
-
|
10
|
-
module PVN::App::Pct
|
11
|
-
class CmdLineArgs < Subcommand::CmdLineArgs
|
12
|
-
include Loggable
|
13
|
-
|
14
|
-
attr_reader :revision
|
15
|
-
attr_reader :path
|
16
|
-
|
17
|
-
def initialize args
|
18
|
-
@limit = nil
|
19
|
-
while !args.empty?
|
20
|
-
arg = args.shift
|
21
|
-
info "arg: #{arg}".cyan
|
22
|
-
case arg
|
23
|
-
when %r{-r(.*)}
|
24
|
-
md = Regexp.last_match
|
25
|
-
info "md: #{md}".on_yellow
|
26
|
-
@revision = Revision.new :value => md[1]
|
27
|
-
else
|
28
|
-
@path = arg
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'pvn/subcommands/revision/multiple_revisions_option'
|
5
|
-
require 'pvn/subcommands/base/options'
|
6
|
-
|
7
|
-
module PVN::Subcommands::Pct
|
8
|
-
class OptionSet < PVN::Subcommands::Base::OptionSet
|
9
|
-
has_option :revision, PVN::MultipleRevisionsRegexpOption
|
10
|
-
has_option :help, PVN::Subcommands::Base::HelpOption
|
11
|
-
end
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'pvn/subcommands/base/options'
|
5
|
-
require 'pvn/subcommands/base/color_option'
|
6
|
-
|
7
|
-
module PVN::Subcommands::Status
|
8
|
-
class OptionSet < PVN::Subcommands::Base::OptionSet
|
9
|
-
has_option :color, PVN::Subcommands::Base::ColorOption
|
10
|
-
has_option :help, PVN::Subcommands::Base::HelpOption
|
11
|
-
end
|
12
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'riel'
|
5
|
-
require 'rubygems'
|
6
|
-
require 'system/cachecmd'
|
7
|
-
|
8
|
-
module PVN
|
9
|
-
# A command that is a simple pass-through (more or less)
|
10
|
-
# to a svn command.
|
11
|
-
class SVNCommand < CachableCommand
|
12
|
-
def self.revision_from_args optset, cmdargs
|
13
|
-
require 'pvn/revision'
|
14
|
-
Revision.revision_from_args optset, cmdargs
|
15
|
-
end
|
16
|
-
|
17
|
-
def initialize args = Hash.new
|
18
|
-
super
|
19
|
-
info "self: #{self}"
|
20
|
-
end
|
21
|
-
|
22
|
-
def to_svn_command fullcmdargs
|
23
|
-
[ "svn", self.class::COMMAND ] + fullcmdargs
|
24
|
-
end
|
25
|
-
|
26
|
-
def command
|
27
|
-
@svncmd.join " "
|
28
|
-
end
|
29
|
-
|
30
|
-
def execute
|
31
|
-
cmdline = options.as_command_line
|
32
|
-
@svncmd = to_svn_command cmdline
|
33
|
-
info "@svncmd: #{@svncmd}"
|
34
|
-
cmd = @svncmd.join(" ")
|
35
|
-
sysexec cmd
|
36
|
-
# @output = IO.popen(cmd).readlines
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/pvn/svn/environment.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'riel'
|
6
|
-
require 'singleton'
|
7
|
-
|
8
|
-
module PVN
|
9
|
-
class Environment
|
10
|
-
include Singleton
|
11
|
-
|
12
|
-
DEFAULT_CACHE_DIR = '/tmp/pvn_testing_cache_dir'
|
13
|
-
|
14
|
-
attr_accessor :cache_dir
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
super
|
18
|
-
|
19
|
-
@cache_dir = DEFAULT_CACHE_DIR
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|