svnx 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/svnx/base/command.rb +1 -1
- data/lib/svnx/base/command_factory.rb +2 -2
- data/lib/svnx/base/entries.rb +4 -12
- data/lib/svnx/base/entry.rb +6 -21
- data/lib/svnx/base/options.rb +43 -14
- data/lib/svnx/blame/command.rb +11 -0
- data/lib/svnx/blame/entries.rb +18 -0
- data/lib/svnx/blame/entry.rb +43 -0
- data/lib/svnx/blame/options.rb +21 -0
- data/lib/svnx/cat/options.rb +8 -8
- data/lib/svnx/commit/options.rb +8 -8
- data/lib/svnx/diff/options.rb +10 -11
- data/lib/svnx/info/entries.rb +1 -1
- data/lib/svnx/info/options.rb +8 -8
- data/lib/svnx/log/entries.rb +6 -6
- data/lib/svnx/log/options.rb +11 -11
- data/lib/svnx/merge/options.rb +11 -13
- data/lib/svnx/project.rb +24 -44
- data/lib/svnx/propget/entries.rb +1 -1
- data/lib/svnx/propget/options.rb +11 -11
- data/lib/svnx/propset/options.rb +12 -11
- data/lib/svnx/status/entries.rb +4 -4
- data/lib/svnx/status/entry.rb +4 -4
- data/lib/svnx/status/options.rb +10 -10
- data/lib/svnx/update/options.rb +8 -8
- data/lib/svnx/util/classutil.rb +2 -5
- data/lib/svnx/util/objutil.rb +23 -13
- data/lib/svnx/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a079b16c8a940b3a4d547cf7181bb598e708134
|
4
|
+
data.tar.gz: 362875ae5402a57065a2c923104f29e27c8e7fa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 212b6748b84d9298c1b9ff59387a7f5e392fb7829e9487b46801a51472c7f39ff0611f4b820526e1b42091ed5d7e73ea000ddbdfbc5ba7109df0515d9c4e5b1a
|
7
|
+
data.tar.gz: fbfbbf3cc940127e16fa01b7a0ab20e1100a862d6c642a7e7f8e8961c7f35cc7ccc0373d2c061671662ca75aa17fe98f5661c9aa1ae86da9e7ec74694d745fe5
|
data/lib/svnx/base/command.rb
CHANGED
@@ -9,10 +9,10 @@ module Svnx::Base
|
|
9
9
|
include Logue::Loggable
|
10
10
|
|
11
11
|
def create cmdcls, cmdlinecls: nil, optcls: nil
|
12
|
-
melements = ClassUtil
|
12
|
+
melements = ClassUtil.module_elements cmdcls
|
13
13
|
|
14
14
|
optcls ||= begin
|
15
|
-
modl = ClassUtil
|
15
|
+
modl = ClassUtil.find_module cmdcls
|
16
16
|
modl::Options
|
17
17
|
end
|
18
18
|
|
data/lib/svnx/base/entries.rb
CHANGED
@@ -18,20 +18,12 @@ module Svnx::Base
|
|
18
18
|
|
19
19
|
attr_reader :size
|
20
20
|
|
21
|
-
def initialize
|
21
|
+
def initialize lines
|
22
22
|
# it's a hash, but indexed with integers, for non-sequential access:
|
23
|
-
@entries
|
24
|
-
|
25
|
-
lines ||= xmllines
|
26
|
-
|
27
|
-
if lines.kind_of? Array
|
28
|
-
lines = lines.join ''
|
29
|
-
end
|
30
|
-
|
31
|
-
doc = REXML::Document.new lines
|
32
|
-
|
23
|
+
@entries = Hash.new
|
24
|
+
doc = REXML::Document.new Array(lines).join
|
33
25
|
@elements = get_elements doc
|
34
|
-
@size
|
26
|
+
@size = @elements.size
|
35
27
|
end
|
36
28
|
|
37
29
|
def get_elements doc
|
data/lib/svnx/base/entry.rb
CHANGED
@@ -13,30 +13,16 @@ module Svnx::Base
|
|
13
13
|
class Entry
|
14
14
|
include Logue::Loggable
|
15
15
|
|
16
|
-
def initialize
|
17
|
-
|
18
|
-
if xmllines.kind_of? Array
|
19
|
-
xmllines = xmllines.join ''
|
20
|
-
end
|
21
|
-
doc = REXML::Document.new xmllines
|
22
|
-
set_from_xml doc
|
23
|
-
elsif xmlelement
|
24
|
-
set_from_element xmlelement
|
25
|
-
else
|
26
|
-
raise "must be initialized with xmllines (received: #{xmllines.inspect}) or xmlelement (received: #{xmlelement.inspect})"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def set_from_xml xmldoc
|
31
|
-
raise "must be implemented"
|
16
|
+
def initialize xmlelement
|
17
|
+
set_from_element xmlelement
|
32
18
|
end
|
33
19
|
|
34
20
|
def set_from_element elmt
|
35
21
|
raise "must be implemented"
|
36
22
|
end
|
37
23
|
|
38
|
-
def set_attr_var xmlelement, varname
|
39
|
-
set_var varname, attribute_value(xmlelement,
|
24
|
+
def set_attr_var xmlelement, varname, attrname = varname
|
25
|
+
set_var varname, xmlelement && attribute_value(xmlelement, attrname)
|
40
26
|
end
|
41
27
|
|
42
28
|
def set_attr_vars xmlelement, *varnames
|
@@ -46,7 +32,7 @@ module Svnx::Base
|
|
46
32
|
end
|
47
33
|
|
48
34
|
def set_elmt_var xmlelement, varname
|
49
|
-
set_var varname, element_text(xmlelement, varname)
|
35
|
+
set_var varname, xmlelement && element_text(xmlelement, varname)
|
50
36
|
end
|
51
37
|
|
52
38
|
def set_elmt_vars xmlelement, *varnames
|
@@ -65,8 +51,7 @@ module Svnx::Base
|
|
65
51
|
|
66
52
|
def element_text xmlelement, elmtname
|
67
53
|
elmt = xmlelement.elements[elmtname.to_s]
|
68
|
-
|
69
|
-
(elmt && elmt.text) || ""
|
54
|
+
elmt && elmt.text || ""
|
70
55
|
end
|
71
56
|
end
|
72
57
|
end
|
data/lib/svnx/base/options.rb
CHANGED
@@ -9,29 +9,58 @@ module Svnx
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module Svnx::Base
|
12
|
+
REVISION_FIELD = Proc.new { |x| [ "-r", x.revision ] }
|
13
|
+
IGNORE_WHITESPACE = { ignorewhitespace: %w{ -x -bw -x --ignore-eol-style } }
|
14
|
+
|
15
|
+
REVISION_PATHS_URLS_FIELDS = Hash.new.tap do |h|
|
16
|
+
h[:revision] = REVISION_FIELD
|
17
|
+
h[:paths] = nil
|
18
|
+
h[:urls] = nil
|
19
|
+
end
|
20
|
+
|
12
21
|
class Options
|
13
22
|
include Svnx::ObjectUtil
|
14
23
|
|
15
|
-
|
16
|
-
|
17
|
-
|
24
|
+
class << self
|
25
|
+
# Creates a reader method for each field
|
26
|
+
def has_fields(*fields)
|
27
|
+
what = Array(fields).flatten
|
28
|
+
attr_reader(*what)
|
18
29
|
end
|
30
|
+
end
|
19
31
|
|
20
|
-
|
21
|
-
|
32
|
+
def initialize args
|
33
|
+
fkeys = fields.keys
|
34
|
+
assign args, fkeys
|
35
|
+
validate args, fkeys
|
36
|
+
end
|
37
|
+
|
38
|
+
def options_to_args
|
39
|
+
fields.keys.collect do |fld|
|
40
|
+
[ fld, get_args(fld) ]
|
22
41
|
end
|
23
42
|
end
|
43
|
+
|
44
|
+
def fields
|
45
|
+
raise "not implemented for #{self.class}"
|
46
|
+
end
|
24
47
|
|
25
48
|
def to_args
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
values = opt[1]
|
30
|
-
if send optname
|
31
|
-
args.concat [ values ].flatten
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
49
|
+
options_to_args.collect do |opt|
|
50
|
+
send(opt.first) ? opt[1] : nil
|
51
|
+
end.compact.flatten
|
35
52
|
end
|
53
|
+
|
54
|
+
def get_args field
|
55
|
+
val = fields[field]
|
56
|
+
case val
|
57
|
+
when Proc
|
58
|
+
val.call self
|
59
|
+
when nil
|
60
|
+
send field
|
61
|
+
else
|
62
|
+
val
|
63
|
+
end
|
64
|
+
end
|
36
65
|
end
|
37
66
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'svnx/blame/entry'
|
5
|
+
require 'svnx/base/entries'
|
6
|
+
|
7
|
+
module Svnx::Blame
|
8
|
+
class Entries < Svnx::Base::Entries
|
9
|
+
def get_elements doc
|
10
|
+
# blame/target
|
11
|
+
doc.elements['blame'].elements['target'].elements
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_entry xmlelement
|
15
|
+
Entry.new xmlelement
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'svnx/base/entry'
|
5
|
+
require 'time'
|
6
|
+
|
7
|
+
module Svnx
|
8
|
+
module Blame
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module Svnx::Blame
|
13
|
+
class Entry < Svnx::Base::Entry
|
14
|
+
include Comparable
|
15
|
+
|
16
|
+
attr_reader :line_number
|
17
|
+
attr_reader :revision
|
18
|
+
attr_reader :author
|
19
|
+
attr_reader :date
|
20
|
+
|
21
|
+
def set_from_element elmt
|
22
|
+
set_attr_var elmt, 'line_number', 'line-number'
|
23
|
+
|
24
|
+
commit = elmt.elements['commit']
|
25
|
+
set_attr_var commit, 'revision'
|
26
|
+
set_elmt_vars commit, 'author', 'date'
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_commit_fields rev, auth, date
|
30
|
+
@commit_revision = rev
|
31
|
+
@commit_author = auth
|
32
|
+
@commit_date = date
|
33
|
+
end
|
34
|
+
|
35
|
+
def <=> other
|
36
|
+
line_number <=> other.line_number
|
37
|
+
end
|
38
|
+
|
39
|
+
def datetime
|
40
|
+
@dt ||= DateTime.parse date
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'svnx/base/options'
|
5
|
+
|
6
|
+
module Svnx
|
7
|
+
module Blame
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Svnx::Blame
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
FIELDS = Svnx::Base::REVISION_PATHS_URLS_FIELDS.merge(Svnx::Base::IGNORE_WHITESPACE)
|
14
|
+
|
15
|
+
has_fields FIELDS.keys
|
16
|
+
|
17
|
+
def fields
|
18
|
+
FIELDS
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/svnx/cat/options.rb
CHANGED
@@ -10,16 +10,16 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Cat
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
FIELDS =
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:revision] = Svnx::Base::REVISION_FIELD
|
15
|
+
h[:path] = nil
|
16
|
+
h[:url] = nil
|
17
|
+
end
|
14
18
|
|
15
|
-
has_fields FIELDS
|
19
|
+
has_fields FIELDS.keys
|
16
20
|
|
17
|
-
def
|
18
|
-
|
19
|
-
a << [ :revision, [ "-r", revision ] ]
|
20
|
-
a << [ :url, url ]
|
21
|
-
a << [ :path, path ]
|
22
|
-
end
|
21
|
+
def fields
|
22
|
+
FIELDS
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/svnx/commit/options.rb
CHANGED
@@ -10,15 +10,15 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Commit
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
FIELDS =
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:file] = Proc.new { |x| [ "-F", x.file ] }
|
15
|
+
h[:paths] = nil
|
16
|
+
end
|
14
17
|
|
15
|
-
has_fields FIELDS
|
18
|
+
has_fields FIELDS.keys
|
16
19
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
a << [ :paths, paths ]
|
21
|
-
end
|
22
|
-
end
|
20
|
+
def fields
|
21
|
+
FIELDS
|
22
|
+
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/svnx/diff/options.rb
CHANGED
@@ -10,19 +10,18 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Diff
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
FIELDS =
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:commit] = Proc.new { |x| [ "-c", x.commit ] }
|
15
|
+
h[:ignoreproperties] = "--ignore-properties"
|
16
|
+
h[:depth] = Proc.new { |x| [ "--depth", x.depth ] }
|
17
|
+
h[:paths] = nil
|
18
|
+
h[:url] = nil
|
19
|
+
end.merge(Svnx::Base::IGNORE_WHITESPACE)
|
14
20
|
|
15
|
-
has_fields FIELDS
|
21
|
+
has_fields FIELDS.keys
|
16
22
|
|
17
|
-
def
|
18
|
-
|
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
|
23
|
+
def fields
|
24
|
+
FIELDS
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
data/lib/svnx/info/entries.rb
CHANGED
data/lib/svnx/info/options.rb
CHANGED
@@ -10,16 +10,16 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Info
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
FIELDS =
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:revision] = Svnx::Base::REVISION_FIELD
|
15
|
+
h[:path] = nil
|
16
|
+
h[:url] = nil
|
17
|
+
end
|
14
18
|
|
15
|
-
has_fields FIELDS
|
19
|
+
has_fields FIELDS.keys
|
16
20
|
|
17
|
-
def
|
18
|
-
|
19
|
-
a << [ :revision, [ "-r", revision ] ]
|
20
|
-
a << [ :url, url ]
|
21
|
-
a << [ :path, path ]
|
22
|
-
end
|
21
|
+
def fields
|
22
|
+
FIELDS
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/svnx/log/entries.rb
CHANGED
@@ -16,15 +16,15 @@ module Svnx::Log
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def create_entry xmlelement
|
19
|
-
Entry.new xmlelement
|
19
|
+
Entry.new xmlelement
|
20
20
|
end
|
21
21
|
|
22
22
|
def match action, filter
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
Array.new.tap do |a|
|
24
|
+
each do |entry|
|
25
|
+
a.concat entry.match(action, filter)
|
26
|
+
end
|
27
|
+
end.sort
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/svnx/log/options.rb
CHANGED
@@ -10,18 +10,18 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Log
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
FIELDS =
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:limit] = Proc.new { |x| [ "--limit", x.limit ] }
|
15
|
+
h[:verbose] = "-v"
|
16
|
+
h[:revision] = Proc.new { |x| "-r" + x.revision.to_s }
|
17
|
+
h[:url] = nil
|
18
|
+
h[:path] = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
has_fields FIELDS.keys
|
14
22
|
|
15
|
-
|
16
|
-
|
17
|
-
def options_to_args
|
18
|
-
Array.new.tap do |a|
|
19
|
-
a << [ :limit, [ "--limit", limit ] ]
|
20
|
-
a << [ :verbose, "-v" ]
|
21
|
-
a << [ :revision, "-r" + revision.to_s ]
|
22
|
-
a << [ :url, url ]
|
23
|
-
a << [ :path, path ]
|
24
|
-
end
|
23
|
+
def fields
|
24
|
+
FIELDS
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/svnx/merge/options.rb
CHANGED
@@ -10,20 +10,18 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Merge
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
|
14
|
-
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:commit] = Proc.new { |x| [ "-c", x.commit ] }
|
15
|
+
h[:range] = Proc.new { |x| [ "-r", x.range ] }
|
16
|
+
h[:accept] = Proc.new { |x| [ "--accept", x.accept ] }
|
17
|
+
h[:from] = nil
|
18
|
+
h[:to] = nil
|
19
|
+
end
|
15
20
|
|
16
|
-
has_fields FIELDS
|
21
|
+
has_fields FIELDS.keys
|
17
22
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
-
a << [ :commit, [ "-c", commit ] ]
|
22
|
-
a << [ :range, [ "-r", range ] ]
|
23
|
-
a << [ :accept, [ "--accept", accept ] ]
|
24
|
-
a << [ :from, from ]
|
25
|
-
a << [ :to, to ]
|
26
|
-
end
|
27
|
-
end
|
23
|
+
def fields
|
24
|
+
FIELDS
|
25
|
+
end
|
28
26
|
end
|
29
27
|
end
|
data/lib/svnx/project.rb
CHANGED
@@ -1,26 +1,19 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require 'logue/loggable'
|
5
|
-
|
6
4
|
module Svnx
|
7
5
|
end
|
8
6
|
|
9
7
|
# A low-level wrapper around the Svnx commands, converting arguments (svnx/<command>/options) into
|
10
8
|
# entries (svnx/<command>/entry) or output. Enhances the low level functionality.
|
11
9
|
|
12
|
-
class Svnx::Project
|
13
|
-
include Logue::Loggable
|
14
|
-
|
10
|
+
class Svnx::Project
|
15
11
|
attr_reader :dir
|
16
12
|
|
17
13
|
def initialize dir: nil, url: nil, cls: nil
|
18
14
|
@dir = dir
|
19
15
|
@url = url
|
20
16
|
@cls = cls
|
21
|
-
debug "dir: #{dir}"
|
22
|
-
debug "url: #{url}"
|
23
|
-
debug "cls: #{cls}"
|
24
17
|
end
|
25
18
|
|
26
19
|
def where
|
@@ -38,47 +31,34 @@ class Svnx::Project
|
|
38
31
|
info.path
|
39
32
|
end
|
40
33
|
|
41
|
-
def
|
42
|
-
cmd
|
43
|
-
|
44
|
-
end
|
34
|
+
def self.add_delegator cmd
|
35
|
+
require "svnx/#{cmd}/command"
|
36
|
+
require "svnx/#{cmd}/options"
|
45
37
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
38
|
+
initargs = Hash[url: "@url", path: "@dir", paths: "[ @dir ]"]
|
39
|
+
optcls = Kernel.const_get "Svnx::#{cmd.to_s.capitalize}::Options"
|
40
|
+
opts = optcls.new Hash.new
|
41
|
+
fields = opts.fields.keys
|
42
|
+
params = fields.collect { |key| key.to_s + ": " + (initargs[key] || "nil") }.join ", "
|
43
|
+
cmdargs = fields.collect { |key| key.to_s + ": " + key.to_s }.join ", "
|
50
44
|
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
src = Array.new.tap do |a|
|
46
|
+
a << "def #{cmd} #{params}, cls: @cls"
|
47
|
+
a << " cmd = Svnx::#{cmd.to_s.capitalize}::Command.new({ #{cmdargs} }, cls: cls)"
|
48
|
+
a << " cmd.respond_to?(:entries) ? cmd.entries : cmd.output"
|
49
|
+
a << "end"
|
50
|
+
end.join "\n"
|
54
51
|
|
55
|
-
|
56
|
-
"Svnx::#{name.to_s.capitalize}::Command",
|
57
|
-
"{ " + pathargs + " }",
|
58
|
-
"**args"
|
59
|
-
]
|
60
|
-
|
61
|
-
src = [
|
62
|
-
"def #{name} cls: nil, **args",
|
63
|
-
" run_command " + args.join(", ") + ", cls: @cls",
|
64
|
-
"end"
|
65
|
-
].join("\n")
|
66
|
-
|
67
|
-
module_eval src
|
52
|
+
class_eval src
|
68
53
|
end
|
69
54
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
add_command_delegator :log, false
|
78
|
-
|
79
|
-
add_command_delegator :diff, true
|
80
|
-
add_command_delegator :propset, false
|
81
|
-
add_command_delegator :propget, false
|
55
|
+
add_delegator :commit
|
56
|
+
add_delegator :diff
|
57
|
+
add_delegator :info
|
58
|
+
add_delegator :log
|
59
|
+
add_delegator :propget
|
60
|
+
add_delegator :propset
|
61
|
+
add_delegator :update
|
82
62
|
|
83
63
|
def to_s
|
84
64
|
where.to_s
|
data/lib/svnx/propget/entries.rb
CHANGED
data/lib/svnx/propget/options.rb
CHANGED
@@ -9,19 +9,19 @@ module Svnx
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module Svnx::Propget
|
12
|
-
class Options < Svnx::Base::Options
|
13
|
-
FIELDS =
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:revision] = Svnx::Base::REVISION_FIELD
|
15
|
+
h[:revprop] = "--revprop"
|
16
|
+
h[:name] = nil
|
17
|
+
h[:url] = nil
|
18
|
+
h[:path] = nil
|
19
|
+
end
|
14
20
|
|
15
|
-
has_fields FIELDS
|
21
|
+
has_fields FIELDS.keys
|
16
22
|
|
17
|
-
def
|
18
|
-
|
19
|
-
a << [ :revision, [ "-r", revision ] ]
|
20
|
-
a << [ :revprop, "--revprop" ]
|
21
|
-
a << [ :name, name ]
|
22
|
-
a << [ :url, url ]
|
23
|
-
a << [ :path, path ]
|
24
|
-
end
|
23
|
+
def fields
|
24
|
+
FIELDS
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/svnx/propset/options.rb
CHANGED
@@ -10,19 +10,20 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Propset
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
|
13
|
+
|
14
|
+
FIELDS = Hash.new.tap do |h|
|
15
|
+
h[:name] = nil
|
16
|
+
h[:revision] = Proc.new { |x| [ "--revprop", "-r", x.revision ] }
|
17
|
+
h[:file] = Proc.new { |x| [ "--file", x.file ] }
|
18
|
+
h[:value] = nil
|
19
|
+
h[:url] = nil
|
20
|
+
h[:path] = nil
|
21
|
+
end
|
14
22
|
|
15
|
-
has_fields FIELDS
|
23
|
+
has_fields FIELDS.keys
|
16
24
|
|
17
|
-
def
|
18
|
-
|
19
|
-
a << [ :name, name ]
|
20
|
-
a << [ :revision, [ "--revprop", "-r", revision ] ]
|
21
|
-
a << [ :file, [ "--file", file ] ]
|
22
|
-
a << [ :value, value ]
|
23
|
-
a << [ :url, url ]
|
24
|
-
a << [ :path, path ]
|
25
|
-
end
|
25
|
+
def fields
|
26
|
+
FIELDS
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
data/lib/svnx/status/entries.rb
CHANGED
@@ -6,9 +6,9 @@ require 'svnx/base/entries'
|
|
6
6
|
|
7
7
|
module Svnx::Status
|
8
8
|
class Entries < Svnx::Base::Entries
|
9
|
-
def initialize
|
10
|
-
@rootpath =
|
11
|
-
super
|
9
|
+
def initialize lines, rootpath: nil
|
10
|
+
@rootpath = rootpath
|
11
|
+
super lines
|
12
12
|
end
|
13
13
|
|
14
14
|
def get_elements doc
|
@@ -17,7 +17,7 @@ module Svnx::Status
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def create_entry xmlelement
|
20
|
-
Entry.new xmlelement
|
20
|
+
Entry.new xmlelement, rootpath: @rootpath
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/svnx/status/entry.rb
CHANGED
@@ -20,9 +20,9 @@ module Svnx::Status
|
|
20
20
|
attr_reader :commit_revision
|
21
21
|
attr_reader :name
|
22
22
|
|
23
|
-
def initialize xmlelement
|
23
|
+
def initialize xmlelement, rootpath: nil
|
24
24
|
@rootpath = rootpath
|
25
|
-
super xmlelement
|
25
|
+
super xmlelement
|
26
26
|
# @status is an Svnx::Action
|
27
27
|
@action = @status
|
28
28
|
end
|
@@ -32,10 +32,10 @@ module Svnx::Status
|
|
32
32
|
|
33
33
|
wcstatus = elmt.elements['wc-status']
|
34
34
|
@status = Svnx::Action.new(wcstatus.attributes['item'])
|
35
|
-
|
35
|
+
set_attr_var wcstatus, 'status_revision', 'revision'
|
36
36
|
|
37
37
|
commit = wcstatus.elements['commit']
|
38
|
-
|
38
|
+
set_attr_var commit, 'commit_revision', 'revision'
|
39
39
|
@name = @path.dup
|
40
40
|
|
41
41
|
if @rootpath
|
data/lib/svnx/status/options.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require 'svnx/
|
4
|
+
require 'svnx/base/options'
|
5
5
|
|
6
6
|
module Svnx
|
7
7
|
module Status
|
@@ -10,16 +10,16 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Status
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
FIELDS =
|
14
|
-
|
15
|
-
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:revision] = Svnx::Base::REVISION_FIELD
|
15
|
+
h[:paths] = nil
|
16
|
+
h[:url] = nil
|
17
|
+
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
a << [ :paths, paths ]
|
22
|
-
end
|
19
|
+
has_fields FIELDS.keys
|
20
|
+
|
21
|
+
def fields
|
22
|
+
FIELDS
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/svnx/update/options.rb
CHANGED
@@ -10,15 +10,15 @@ end
|
|
10
10
|
|
11
11
|
module Svnx::Update
|
12
12
|
class Options < Svnx::Base::Options
|
13
|
-
FIELDS =
|
14
|
-
|
15
|
-
|
13
|
+
FIELDS = Hash.new.tap do |h|
|
14
|
+
h[:revision] = Svnx::Base::REVISION_FIELD
|
15
|
+
h[:paths] = nil
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
18
|
+
has_fields FIELDS.keys
|
19
|
+
|
20
|
+
def fields
|
21
|
+
FIELDS
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/svnx/util/classutil.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
class ClassUtil
|
5
|
+
class << self
|
6
6
|
def module_elements cls
|
7
7
|
mods = cls.name.split "::"
|
8
8
|
mods[0 .. -2]
|
@@ -12,8 +12,5 @@ module ClassUtil
|
|
12
12
|
mod = module_elements(cls) * "::"
|
13
13
|
Kernel.const_get mod
|
14
14
|
end
|
15
|
-
|
16
|
-
module_function :module_elements
|
17
|
-
module_function :find_module
|
18
15
|
end
|
19
16
|
end
|
data/lib/svnx/util/objutil.rb
CHANGED
@@ -10,27 +10,37 @@ module Svnx
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
# raises an exception if any element in +args+ is not in +valid+.
|
13
14
|
def validate args, valid = Array.new
|
14
|
-
invalid = args.keys.reject
|
15
|
-
|
16
|
-
|
15
|
+
invalid = args.keys.reject { |field| valid.include? field }
|
16
|
+
invalid.empty? || raise(create_invalid_fields_message invalid)
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
def create_invalid_fields_message fields
|
20
|
+
Array.new.tap do |a|
|
21
|
+
a << "invalid"
|
22
|
+
a << (fields.size == 1 ? "field" : "fields" )
|
23
|
+
a << "for"
|
24
|
+
a << self.class.to_s + ":"
|
25
|
+
a.concat fields
|
26
|
+
end.join(" ")
|
21
27
|
end
|
22
28
|
|
23
|
-
module ClassMethods
|
24
|
-
def attr_readers
|
25
|
-
|
29
|
+
module ClassMethods
|
30
|
+
def attr_readers(*symbols)
|
31
|
+
what = Array(symbols).flatten
|
32
|
+
attr_reader(*what)
|
26
33
|
end
|
27
34
|
|
28
|
-
|
29
|
-
|
35
|
+
# Creates a reader method for each field, and assigns and validates them from an initialize
|
36
|
+
# method, which is also created.
|
37
|
+
def xhas_fields(*fields)
|
38
|
+
what = Array(fields).flatten
|
39
|
+
attr_reader(*what)
|
30
40
|
|
31
41
|
define_method :initialize do |args|
|
32
|
-
assign args,
|
33
|
-
validate args,
|
42
|
+
assign args, what
|
43
|
+
validate args, what
|
34
44
|
end
|
35
45
|
end
|
36
46
|
end
|
data/lib/svnx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svnx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Pace
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,6 +113,10 @@ files:
|
|
113
113
|
- lib/svnx/base/entry.rb
|
114
114
|
- lib/svnx/base/env.rb
|
115
115
|
- lib/svnx/base/options.rb
|
116
|
+
- lib/svnx/blame/command.rb
|
117
|
+
- lib/svnx/blame/entries.rb
|
118
|
+
- lib/svnx/blame/entry.rb
|
119
|
+
- lib/svnx/blame/options.rb
|
116
120
|
- lib/svnx/cat/command.rb
|
117
121
|
- lib/svnx/cat/options.rb
|
118
122
|
- lib/svnx/commit/command.rb
|