svnx 2.0.6 → 2.1.0
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.zshrc +2 -0
- data/Rakefile +2 -3
- data/lib/cmdline/arg.rb +12 -0
- data/lib/cmdline/cachefile.rb +37 -0
- data/lib/cmdline/caching.rb +25 -0
- data/lib/cmdline/filename.rb +16 -0
- data/lib/cmdline/gzpathname.rb +26 -0
- data/lib/cmdline/line.rb +57 -0
- data/lib/svnx/base/action.rb +31 -61
- data/lib/svnx/base/action_status.rb +37 -0
- data/lib/svnx/base/cmd.rb +20 -0
- data/lib/svnx/base/cmdline.rb +43 -37
- data/lib/svnx/base/command.rb +57 -50
- data/lib/svnx/base/command_factory.rb +24 -0
- data/lib/svnx/base/entries.rb +42 -40
- data/lib/svnx/base/entry.rb +46 -44
- data/lib/svnx/base/env.rb +14 -15
- data/lib/svnx/base/options.rb +22 -10
- data/lib/svnx/cat/command.rb +4 -2
- data/lib/svnx/cat/options.rb +11 -14
- data/lib/svnx/commit/command.rb +4 -2
- data/lib/svnx/commit/options.rb +11 -16
- data/lib/svnx/diff/command.rb +9 -7
- data/lib/svnx/diff/elements.rb +56 -54
- data/lib/svnx/diff/options.rb +14 -21
- data/lib/svnx/diff/parser.rb +73 -71
- data/lib/svnx/info/command.rb +4 -2
- data/lib/svnx/info/entries.rb +8 -6
- data/lib/svnx/info/entry.rb +23 -17
- data/lib/svnx/info/options.rb +11 -14
- data/lib/svnx/io/directory.rb +3 -1
- data/lib/svnx/io/element.rb +88 -86
- data/lib/svnx/log/command.rb +4 -2
- data/lib/svnx/log/entries.rb +14 -12
- data/lib/svnx/log/entry.rb +36 -58
- data/lib/svnx/log/entrypath.rb +35 -0
- data/lib/svnx/log/options.rb +14 -18
- data/lib/svnx/merge/command.rb +4 -2
- data/lib/svnx/merge/options.rb +17 -22
- data/lib/svnx/project.rb +27 -15
- data/lib/svnx/propget/command.rb +4 -2
- data/lib/svnx/propget/entries.rb +8 -6
- data/lib/svnx/propget/entry.rb +12 -10
- data/lib/svnx/propget/options.rb +13 -17
- data/lib/svnx/propset/command.rb +4 -2
- data/lib/svnx/propset/options.rb +14 -19
- data/lib/svnx/revision/argfactory.rb +6 -2
- data/lib/svnx/revision/argument.rb +22 -19
- data/lib/svnx/revision/date.rb +16 -16
- data/lib/svnx/revision/error.rb +4 -1
- data/lib/svnx/revision/range.rb +2 -1
- data/lib/svnx/status/command.rb +4 -2
- data/lib/svnx/status/entries.rb +13 -11
- data/lib/svnx/status/entry.rb +37 -39
- data/lib/svnx/status/options.rb +12 -15
- data/lib/svnx/update/command.rb +4 -2
- data/lib/svnx/update/options.rb +11 -12
- data/lib/svnx/util/classutil.rb +19 -0
- data/lib/svnx/util/dateutil.rb +1 -0
- data/lib/svnx/util/objutil.rb +36 -6
- data/lib/svnx/version.rb +1 -1
- data/repackage +1 -0
- data/svnx.gemspec +6 -5
- metadata +29 -6
- data/lib/system/command/arg.rb +0 -13
- data/lib/system/command/cachefile.rb +0 -58
- data/lib/system/command/caching.rb +0 -23
- data/lib/system/command/line.rb +0 -58
data/lib/svnx/cat/options.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require 'svnx/util/objutil'
|
5
4
|
require 'svnx/base/options'
|
6
5
|
|
7
6
|
module Svnx
|
@@ -9,20 +8,18 @@ module Svnx
|
|
9
8
|
end
|
10
9
|
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def initialize args
|
18
|
-
assign args, :revision, :url, :path
|
19
|
-
end
|
11
|
+
module Svnx::Cat
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
FIELDS = [ :revision, :path, :url ]
|
14
|
+
|
15
|
+
has_fields FIELDS
|
20
16
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
def options_to_args
|
18
|
+
Array.new.tap do |a|
|
19
|
+
a << [ :revision, [ "-r", revision ] ]
|
20
|
+
a << [ :url, url ]
|
21
|
+
a << [ :path, path ]
|
22
|
+
end
|
26
23
|
end
|
27
24
|
end
|
28
25
|
end
|
data/lib/svnx/commit/command.rb
CHANGED
data/lib/svnx/commit/options.rb
CHANGED
@@ -8,22 +8,17 @@ module Svnx
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
module Svnx::Commit
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
FIELDS = [ :file, :paths ]
|
13
14
|
|
14
|
-
|
15
|
-
attr_reader :paths
|
16
|
-
attr_reader :url
|
17
|
-
|
18
|
-
def initialize args = Hash.new
|
19
|
-
assign args, :file, :paths, :url
|
20
|
-
end
|
15
|
+
has_fields FIELDS
|
21
16
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
17
|
+
def options_to_args
|
18
|
+
Array.new.tap do |a|
|
19
|
+
a << [ :file, [ "-F", file ] ]
|
20
|
+
a << [ :paths, paths ]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
29
24
|
end
|
data/lib/svnx/diff/command.rb
CHANGED
@@ -5,13 +5,15 @@ require 'svnx/diff/options'
|
|
5
5
|
require 'svnx/base/command'
|
6
6
|
require 'svnx/diff/parser'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
module Svnx::Diff
|
9
|
+
class Command < Svnx::Base::Command
|
10
|
+
attr_reader :entries
|
11
|
+
|
12
|
+
def initialize cmdopts, cls: Svnx::Base::CommandLine
|
13
|
+
super cmdopts, cls: cls, xml: false, caching: true
|
14
|
+
if @output
|
15
|
+
@entries = Svnx::Diff::Parser.new.parse_all_output @output.dup
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/lib/svnx/diff/elements.rb
CHANGED
@@ -8,77 +8,79 @@ module Svnx
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
module Svnx::Diff
|
12
|
+
class File
|
13
|
+
attr_reader :filename
|
14
|
+
attr_reader :revision
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
def initialize args
|
17
|
+
@filename = args[:filename]
|
18
|
+
@revision = args[:revision]
|
19
|
+
end
|
18
20
|
end
|
19
|
-
end
|
20
21
|
|
21
|
-
class
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
class Header
|
23
|
+
attr_reader :filename
|
24
|
+
attr_reader :from
|
25
|
+
attr_reader :to
|
26
|
+
|
27
|
+
def initialize args
|
28
|
+
@filename = args[:filename]
|
29
|
+
@from = args[:from]
|
30
|
+
@to = args[:to]
|
31
|
+
end
|
30
32
|
end
|
31
|
-
end
|
32
33
|
|
33
|
-
class
|
34
|
-
|
35
|
-
|
34
|
+
class HunkRange
|
35
|
+
attr_reader :line
|
36
|
+
attr_reader :length
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
def initialize line, length
|
39
|
+
@line = line
|
40
|
+
@length = length
|
41
|
+
end
|
40
42
|
end
|
41
|
-
end
|
42
43
|
|
43
|
-
class
|
44
|
-
|
45
|
-
|
44
|
+
class HunkRanges
|
45
|
+
attr_reader :from
|
46
|
+
attr_reader :to
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
def initialize from, to
|
49
|
+
@from = from
|
50
|
+
@to = to
|
51
|
+
end
|
50
52
|
end
|
51
|
-
end
|
52
53
|
|
53
|
-
# unused; I prefer a two-element array: [ :added, "sometext" ]
|
54
|
+
# unused; I prefer a two-element array: [ :added, "sometext" ]
|
54
55
|
|
55
|
-
class
|
56
|
-
|
57
|
-
|
56
|
+
class Line
|
57
|
+
attr_reader :type
|
58
|
+
attr_reader :text
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
60
|
+
def initialize type, text
|
61
|
+
@type = type
|
62
|
+
@text = text
|
63
|
+
end
|
62
64
|
end
|
63
|
-
end
|
64
65
|
|
65
|
-
class
|
66
|
-
|
67
|
-
|
66
|
+
class Hunk
|
67
|
+
attr_reader :ranges
|
68
|
+
attr_reader :lines
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
def initialize ranges, lines
|
71
|
+
@ranges = ranges
|
72
|
+
@lines = lines
|
73
|
+
end
|
72
74
|
end
|
73
|
-
end
|
74
75
|
|
75
|
-
# all diffs for one file
|
76
|
-
class SvnFileDiff
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
76
|
+
# all diffs for one file
|
77
|
+
class SvnFileDiff
|
78
|
+
attr_reader :header
|
79
|
+
attr_reader :hunks
|
80
|
+
|
81
|
+
def initialize header, hunks = Array.new
|
82
|
+
@header = header
|
83
|
+
@hunks = hunks
|
84
|
+
end
|
83
85
|
end
|
84
86
|
end
|
data/lib/svnx/diff/options.rb
CHANGED
@@ -8,28 +8,21 @@ module Svnx
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
attr_reader :url
|
17
|
-
|
18
|
-
def initialize args = Hash.new
|
19
|
-
@commit = args[:commit]
|
20
|
-
@ignoreproperties = args[:ignoreproperties]
|
21
|
-
@ignorewhitespace = args[:ignorewhitespace]
|
22
|
-
@paths = args[:paths]
|
23
|
-
@url = args[:url]
|
24
|
-
end
|
11
|
+
module Svnx::Diff
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
FIELDS = [ :commit, :ignoreproperties, :ignorewhitespace, :paths, :url, :depth ]
|
14
|
+
|
15
|
+
has_fields FIELDS
|
25
16
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
17
|
+
def options_to_args
|
18
|
+
Array.new.tap do |a|
|
19
|
+
a << [ :commit, [ "-c", commit ] ]
|
20
|
+
a << [ :ignoreproperties, "--ignore-properties" ]
|
21
|
+
a << [ :depth, [ "--depth", depth ] ]
|
22
|
+
a << [ :ignorewhitespace, [ "-x", "-bw" ] ]
|
23
|
+
a << [ :url, url ]
|
24
|
+
a << [ :paths, paths ]
|
25
|
+
end
|
33
26
|
end
|
34
27
|
end
|
35
28
|
end
|
data/lib/svnx/diff/parser.rb
CHANGED
@@ -4,100 +4,102 @@
|
|
4
4
|
require 'logue/loggable'
|
5
5
|
require 'svnx/diff/elements'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
module Svnx::Diff
|
8
|
+
class Parser
|
9
|
+
include Logue::Loggable
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def parse_header_file lines
|
12
|
+
re = Regexp.new '^[\-\+]{3} (.*)\t\((?:nonexistent|working copy|revision (\d+))\)'
|
13
|
+
if md = re.match(lines.first)
|
14
|
+
lines.shift
|
15
|
+
File.new filename: md[1], revision: md[2] && md[2].to_i
|
16
|
+
end
|
15
17
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
lines.shift
|
18
|
+
|
19
|
+
def parse_header_section lines
|
20
|
+
re = Regexp.new '^Index: (.*)'
|
21
|
+
if md = re.match(lines.first)
|
22
|
+
filename = md[1]
|
23
|
+
lines.shift
|
24
|
+
|
25
|
+
# discard the ==== line:
|
26
|
+
lines.shift
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
from = parse_header_file lines
|
29
|
+
to = parse_header_file lines
|
30
|
+
|
31
|
+
Header.new filename: filename, from: from, to: to
|
32
|
+
end
|
31
33
|
end
|
32
|
-
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
35
|
+
def parse_ranges lines
|
36
|
+
range_re = Regexp.new '@@ \-(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@'
|
37
|
+
if md = range_re.match(lines.first)
|
38
|
+
lines.shift
|
39
|
+
|
40
|
+
from, to = [ 1, 3 ].collect do |idx|
|
41
|
+
HunkRange.new md[idx].to_i, (md[idx + 1] || 1).to_i
|
42
|
+
end
|
43
|
+
|
44
|
+
HunkRanges.new from, to
|
41
45
|
end
|
42
|
-
|
43
|
-
Svnx::Diff::HunkRanges.new from, to
|
44
46
|
end
|
45
|
-
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
48
|
+
def parse_hunk lines
|
49
|
+
if ranges = parse_ranges(lines)
|
50
|
+
Hunk.new(ranges, Array.new).tap do |hunk|
|
51
|
+
char_to_type = { ' ' => :context, '+' => :added, '-' => :deleted }
|
52
|
+
|
53
|
+
while !lines.empty?
|
54
|
+
if lines.first == "\"
|
55
|
+
hunk.lines << [ :context, :no_newline ]
|
56
|
+
lines.shift
|
57
|
+
elsif type = char_to_type[lines.first[0]]
|
58
|
+
hunk.lines << [ type, lines.shift[1 .. -1] ]
|
59
|
+
else
|
60
|
+
break
|
61
|
+
end
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
64
|
-
end
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
67
|
+
def parse_hunks lines
|
68
|
+
Array.new.tap do |hunks|
|
69
|
+
while !lines.empty?
|
70
|
+
if hunk = parse_hunk(lines)
|
71
|
+
hunks << hunk
|
72
|
+
else
|
73
|
+
break
|
74
|
+
end
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
76
|
-
end
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
79
|
+
def parse_file_diff lines
|
80
|
+
if header = parse_header_section(lines)
|
81
|
+
SvnFileDiff.new(header).tap do |diff|
|
82
|
+
if header.from && header.to
|
83
|
+
while !lines.empty?
|
84
|
+
if hunk = parse_hunk(lines)
|
85
|
+
diff.hunks << hunk
|
86
|
+
else
|
87
|
+
break
|
88
|
+
end
|
87
89
|
end
|
88
90
|
end
|
89
91
|
end
|
90
92
|
end
|
91
93
|
end
|
92
|
-
end
|
93
94
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
95
|
+
def parse_all_output lines
|
96
|
+
Array.new.tap do |diffs|
|
97
|
+
until lines.empty?
|
98
|
+
if filediff = parse_file_diff(lines)
|
99
|
+
diffs << filediff
|
100
|
+
else
|
101
|
+
break
|
102
|
+
end
|
101
103
|
end
|
102
104
|
end
|
103
105
|
end
|