svnx 2.7.2 → 2.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 759f64ff2fb82a12e58b4ae33be6f1ab5df391af
4
- data.tar.gz: e319aced5f94a6447b1304e3684102427d111a73
3
+ metadata.gz: ee2f457c3e6d933420b413b096eedae95a3decbc
4
+ data.tar.gz: bf37347ef5a34295118aad381c99989654f691b8
5
5
  SHA512:
6
- metadata.gz: b9307ee3595171bf6490a8b974e274ca95dd35a40a59e7ca48c2d0019ce0f77afc0da3fb554be80288a45da10a8f7c583954e9a9ac34f57efd5c8ed2843daf97
7
- data.tar.gz: c3d7e0bbf22495b43c0db7d506bf3a941753a2085cd689cb0644d83135068b898ca12cfd2f5d3a6616791859df71db74f5333c48dc3ab7342530b2f36e8d7bd4
6
+ metadata.gz: 7bb4a5fb1970c4f169b8127980535f15ce625fc197b750cf6b630802c43e3cc8976605f44e56bd645bd0d2ed6c0a9cabcc6c4903fe73f3037d541c5cc54ef2fc
7
+ data.tar.gz: 5e5460362594822a2e48a1b59ab1b72523c1de289348568a9b80a42071fa41c59cc100a0416375a5ea9a1f14a968db1930f9fd9a34cdeab801f0ed3a411f1930
@@ -11,7 +11,7 @@ module Svnx
11
11
  super
12
12
  else
13
13
  type = args.first
14
- types = constants(false)
14
+ types = constants false
15
15
  types.each do |t|
16
16
  tc = const_get t
17
17
  if tc.type == type.to_sym || tc.abbrev == type
@@ -53,9 +53,7 @@ module Svnx
53
53
  Action.const_set str.upcase, action
54
54
  methname = str + '?'
55
55
  define_method methname do
56
- instance_eval do
57
- @type.to_sym == sym
58
- end
56
+ @type.to_sym == sym
59
57
  end
60
58
  end
61
59
  end
@@ -19,24 +19,19 @@ module Svnx::Base
19
19
  attr_reader :status
20
20
 
21
21
  def initialize subcommand: nil, xml: true, caching: false, args: Array.new
22
- debug "subcommand: #{subcommand}"
23
- debug "args: #{args}"
24
22
  @subcommand = subcommand
25
23
  @xml = xml
26
24
  @caching = caching
27
25
  @args = args
28
- debug "@args: #{@args}"
29
26
  end
30
27
 
31
28
  def execute
32
29
  cmdargs = [ 'svn', @subcommand ]
33
30
  cmdargs << '--xml' if @xml
34
31
  cmdargs.concat @args
35
- debug "cmdargs: #{cmdargs}"
36
32
 
37
33
  cmdline = command_line cmdargs
38
34
  cmdline.execute
39
- debug "cmdline: #{cmdline}"
40
35
 
41
36
  @output = cmdline.output
42
37
  @error = cmdline.error
@@ -29,22 +29,30 @@ module Svnx::Base
29
29
  attr_reader :options
30
30
 
31
31
  def initialize options, cmdlinecls: nil, optcls: nil, xml: false, caching: caching?
32
+ debug "options: #{options}"
32
33
  factory = CommandFactory.new
33
34
 
34
35
  params = factory.create self.class, cmdlinecls: cmdlinecls, optcls: optcls
35
36
 
36
37
  optcls ||= params.options
38
+ debug "optcls: #{optcls}"
37
39
 
38
40
  @options = optcls.new options
39
41
  cmdargs = @options.to_args
42
+ debug "cmdargs: #{cmdargs}"
40
43
 
41
44
  subcommand = params.subcommand
42
45
 
43
46
  cmdlinecls ||= params.cmdline
47
+
48
+ debug "subcommand: #{subcommand}"
44
49
 
45
50
  @cmdline = cmdlinecls.new(subcommand: subcommand, xml: xml, caching: caching, args: cmdargs)
51
+ debug "@cmdline: #{@cmdline}"
46
52
 
47
53
  @output = @cmdline.execute
54
+ debug "@output: #{@output}"
55
+
48
56
  @error = @cmdline.error
49
57
  @status = @cmdline.status
50
58
  end
@@ -20,7 +20,7 @@ module Svnx::Base
20
20
  class CommandFactory
21
21
  include Logue::Loggable
22
22
 
23
- def create cmdcls, cmdlinecls: CommandLine, optcls: nil
23
+ def create cmdcls, cmdlinecls: nil, optcls: nil
24
24
  melements = ClassUtil.module_elements cmdcls
25
25
 
26
26
  optcls ||= begin
@@ -42,14 +42,14 @@ module Svnx::Base
42
42
  end
43
43
 
44
44
  def [] idx
45
- if entry = @entries[idx]
46
- return entry
47
- end
48
45
  if idx >= size
49
46
  raise "error: index #{idx} is not in range(0 .. #{size})"
50
47
  elsif idx < 0
51
48
  idx = size + idx
52
49
  end
50
+ if entry = @entries[idx]
51
+ return entry
52
+ end
53
53
  @entries[idx] = create_entry @elements[idx]
54
54
  end
55
55
 
@@ -21,8 +21,18 @@ module Svnx::Base
21
21
  raise "must be implemented"
22
22
  end
23
23
 
24
- def set_attr_var xmlelement, varname, attrname = varname
25
- set_var varname, xmlelement && attribute_value(xmlelement, attrname)
24
+ def set_attr_var xmlelement, varname, attrname = varname, convert: nil
25
+ value = if xmlelement
26
+ val = attribute_value xmlelement, attrname
27
+ if convert
28
+ val = val.send convert
29
+ end
30
+ val
31
+ else
32
+ nil
33
+ end
34
+
35
+ set_var varname, value
26
36
  end
27
37
 
28
38
  def set_attr_vars xmlelement, *varnames
@@ -54,6 +54,20 @@ module Svnx::Base
54
54
  tag
55
55
  end
56
56
  end
57
+
58
+ def has_tag_field name
59
+ has_field name, to_tag(name)
60
+ end
61
+
62
+ def has_tag_fields(*names)
63
+ names.each do |name|
64
+ has_tag_field name
65
+ end
66
+ end
67
+
68
+ def has_tag_argument tagname, methname
69
+ has_field methname, to_args(tagname, methname)
70
+ end
57
71
  end
58
72
 
59
73
  def initialize args
@@ -11,7 +11,7 @@ module Svnx::Log
11
11
  attr_reader :revision, :reverse_merge, :author, :date, :paths, :msg, :entries
12
12
 
13
13
  def set_from_element elmt
14
- set_attr_var elmt, 'revision'
14
+ set_attr_var elmt, 'revision', convert: :to_i
15
15
  @reverse_merge = attribute_value elmt, 'reverse-merge'
16
16
 
17
17
  set_elmt_vars elmt, 'author', 'date', 'msg'
@@ -33,6 +33,10 @@ module Svnx::Log
33
33
  [ @revision, @author, @date, @msg ].collect { |x| x.to_s }.join " "
34
34
  end
35
35
 
36
+ def inspect
37
+ to_s
38
+ end
39
+
36
40
  def match action, filter
37
41
  paths.select do |path|
38
42
  path.match? action, filter
@@ -11,11 +11,10 @@ end
11
11
 
12
12
  module Svnx::Log
13
13
  class Options < Svnx::Base::Options
14
- has_fields limit: to_args("--limit", :limit),
15
- verbose: "-v",
16
- stop_on_copy: to_tag(:stop_on_copy),
17
- use_merge_history: to_tag(:use_merge_history),
18
- depth: to_args("--depth", :depth)
14
+ has_fields limit: to_args("--limit", :limit),
15
+ verbose: "-v",
16
+ depth: to_args("--depth", :depth)
17
+ has_tag_fields :stop_on_copy, :use_merge_history
19
18
  has :revision, :url, :path
20
19
  end
21
20
  end
data/lib/svnx/project.rb CHANGED
@@ -35,8 +35,9 @@ class Svnx::Project
35
35
  require "svnx/#{cmd}/command"
36
36
  require "svnx/#{cmd}/options"
37
37
 
38
- initargs = Hash[url: "@url", path: "@dir", paths: "[ @dir ]"]
39
- optcls = Kernel.const_get "Svnx::#{cmd.to_s.capitalize}::Options"
38
+ modname = Kernel.const_get "Svnx::" + cmd.to_s.capitalize
39
+ initargs = { url: "@url", path: "@dir", paths: "[ @dir ]" }
40
+ optcls = modname::Options
40
41
  opts = optcls.new Hash.new
41
42
  fields = opts.fields.keys
42
43
  params = fields.collect { |key| key.to_s + ": " + (initargs[key] || "nil") }.join ", "
@@ -44,8 +45,8 @@ class Svnx::Project
44
45
 
45
46
  src = Array.new.tap do |a|
46
47
  a << "def #{cmd} #{params}, cmdlinecls: @cmdlinecls"
47
- a << " cmd = Svnx::#{cmd.to_s.capitalize}::Command.new({ #{cmdargs} }, cmdlinecls: cmdlinecls)"
48
- a << " cmd.respond_to?(:entries) ? cmd.entries : cmd.output"
48
+ a << " svncmd = #{modname}::Command.new({ #{cmdargs} }, cmdlinecls: cmdlinecls)"
49
+ a << " svncmd.respond_to?(:entries) ? svncmd.entries : svncmd.output"
49
50
  a << "end"
50
51
  end.join "\n"
51
52
 
@@ -13,7 +13,7 @@ module Svnx::Propset
13
13
  has_fields name: nil,
14
14
  revision: Proc.new { |x| [ "--revprop", "-r", x.send(:revision) ] }
15
15
  has :file
16
- has_fields value: nil
16
+ has_field :value, nil
17
17
  has :url, :path
18
18
  end
19
19
  end
@@ -10,7 +10,9 @@ end
10
10
 
11
11
  module Svnx::Update
12
12
  class Options < Svnx::Base::Options
13
- has :revision
14
- has :paths
13
+ has :revision, :paths
14
+ has_tag_argument "--depth", :depth
15
+ has_tag_argument "--set-depth", :set_depth
16
+ has_tag_field :ignore_externals
15
17
  end
16
18
  end
data/lib/svnx/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  module Svnx
5
5
  NAME = 'svnx'
6
- VERSION = '2.7.2'
6
+ VERSION = '2.8.1'
7
7
  end
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.7.2
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Pace
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-12 00:00:00.000000000 Z
11
+ date: 2019-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: command-cacheable