svnx 2.9.0 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1e8e4a0e4c8becac18da9d39aaeb0f9db52e683
4
- data.tar.gz: 247d8f5ba0974ba965066ef6058f073c53020757
3
+ metadata.gz: 1122bd68ff487bab49f705895f6055e7515fd976
4
+ data.tar.gz: fdaa77e7db8b9f74096297b900db7dbc4d17d323
5
5
  SHA512:
6
- metadata.gz: 79e7e4bfad279b50d113d905cfba6ce0b8faffa1bddf7bfd11b67ac7dd8c841934369de3e2846dbd0ea7e4e31eae128770579e0de5a043cf25790c8f49e560c9
7
- data.tar.gz: d4ad3cf461a5ff4d26635e452b3c056ad8edbacbcdf652a6a703d115b8025cb8cda70d90b19acd786ff76903ef3b59df84153ef8111a637f32a734990c4028ff
6
+ metadata.gz: b023f779f02aacba414699568ac6056fc62cf06c7c26729723034e8e4c16c40709dd062c10cadd37a4121a9aa694485169292df4a3a3e7e617ef61818a12e4f3
7
+ data.tar.gz: 6b81673dcaad702f88bbb826c2e609014dbe0599103e308a04d21d08192beb68e2b594574cc8ab2016ee6c4180bd006727393e2bc222048f33decfd846333b75
@@ -45,6 +45,7 @@ module Svnx
45
45
  :modified => 'M',
46
46
  :replaced => 'R',
47
47
  :unversioned => '?',
48
+ :missing => '?',
48
49
  :external => 'X',
49
50
  :normal => 'q' # actually, X, but in a different column than X for external
50
51
  ].each do |sym, char|
@@ -3,7 +3,6 @@
3
3
 
4
4
  require 'rexml/document'
5
5
  require 'nokogiri'
6
- require 'logue/loggable'
7
6
 
8
7
  module Svnx
9
8
  module Base
@@ -17,7 +16,7 @@ $use_nokogiri = true
17
16
 
18
17
  module Svnx::Base
19
18
  class Entries
20
- include Logue::Loggable, Enumerable
19
+ include Enumerable
21
20
 
22
21
  attr_reader :size
23
22
 
@@ -41,29 +40,33 @@ module Svnx::Base
41
40
  raise "create_entry must be implemented for: #{self.class}"
42
41
  end
43
42
 
44
- def [] idx
45
- if idx >= size
46
- raise "error: index #{idx} is not in range(0 .. #{size})"
47
- elsif idx < 0
48
- idx = size + idx
49
- end
50
- if entry = @entries[idx]
51
- return entry
52
- end
53
- @entries[idx] = create_entry @elements[idx]
43
+ def to_index idx
44
+ idx < 0 ? size + idx : idx
54
45
  end
55
46
 
56
- def each(&blk)
57
- # all elements must be processed before each can run:
58
- if @elements
59
- @elements.each_with_index do |element, idx|
60
- @entries[idx] ||= create_entry element
47
+ def [] idx
48
+ if idx.kind_of? Range
49
+ fridx = to_index idx.first
50
+ toidx = to_index idx.last
51
+ rg = Range.new fridx, toidx, idx.exclude_end?
52
+ rg.collect { |x| self[x] }
53
+ else
54
+ if idx >= size
55
+ raise "error: index #{idx} is not in range(0 .. #{size})"
56
+ else
57
+ idx = to_index idx
61
58
  end
62
-
63
- @elements = nil
59
+ if entry = @entries[idx]
60
+ return entry
61
+ end
62
+ @entries[idx] = create_entry @elements[idx]
64
63
  end
65
-
66
- @entries.keys.sort.collect { |idx| @entries[idx] }.each(&blk)
64
+ end
65
+
66
+ def each(&blk)
67
+ (0 ... size).collect do |idx|
68
+ @entries[idx] ||= create_entry @elements[idx]
69
+ end.each(&blk)
67
70
  end
68
71
  end
69
72
  end
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/ruby -w
2
2
  # -*- ruby -*-
3
3
 
4
- require 'svnx/util/strutil'
4
+ module Svnx
5
+ module Base
6
+ end
7
+ end
5
8
 
6
9
  module Svnx::Base
7
10
  module Fields
@@ -61,6 +61,18 @@ module Svnx::Base
61
61
  def has_tag_argument tagname, methname
62
62
  has_field methname, to_args(tagname, methname)
63
63
  end
64
+
65
+ def has_tag_arg name
66
+ has_field name, to_args(to_tag(name), name)
67
+ end
68
+
69
+ def has_tag_arguments(*names)
70
+ names.each do |name|
71
+ tag = to_tag name
72
+ args = to_args tag, name
73
+ has_field name, args
74
+ end
75
+ end
64
76
  end
65
77
 
66
78
  extend ClassMethods
@@ -11,6 +11,6 @@ end
11
11
  module Svnx::Commit
12
12
  class Options < Svnx::Base::Options
13
13
  has :file, :paths
14
- has_fields with_revprop: to_args("--with-revprop", :with_revprop)
14
+ has_tag_arguments :with_revprop, :message, :username, :password
15
15
  end
16
16
  end
@@ -11,10 +11,8 @@ 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
- depth: to_args("--depth", :depth)
17
- has_tag_fields :stop_on_copy, :use_merge_history
14
+ has_tag_arguments :limit, :depth
15
+ has_tag_fields :verbose, :stop_on_copy, :use_merge_history
18
16
  has :revision, :url, :path
19
17
  end
20
18
  end
@@ -9,9 +9,9 @@ module Svnx
9
9
  end
10
10
 
11
11
  module Svnx::Propget
12
- class Options < Svnx::Base::Options
13
- has_fields revprop: "--revprop",
14
- name: nil
12
+ class Options < Svnx::Base::Options
13
+ has_tag_field :revprop
15
14
  has :revision, :url, :path
15
+ has_fields name: nil
16
16
  end
17
17
  end
@@ -10,14 +10,40 @@ module Svnx
10
10
  end
11
11
 
12
12
  module Svnx::Status
13
+ class Commit
14
+ attr_reader :revision
15
+ attr_reader :author
16
+ attr_reader :date
17
+
18
+ def initialize elmt
19
+ rev = elmt['revision']
20
+ @revision = rev.nil? ? rev : rev.to_i
21
+ @author = elmt.at_xpath('author').text
22
+ @date = elmt.at_xpath('date').text
23
+ end
24
+ end
25
+
26
+ class WorkingCopy
27
+ attr_reader :properties
28
+ attr_reader :status
29
+ attr_reader :revision
30
+ attr_reader :commit
31
+
32
+ def initialize wcstatus
33
+ @properties = wcstatus['props']
34
+ @status = Svnx::Action.new wcstatus['item']
35
+ @revision = (n = wcstatus['revision']) && n.to_i
36
+ commit = wcstatus.at_xpath 'commit'
37
+ @commit = commit && Commit.new(commit)
38
+ end
39
+ end
40
+
13
41
  class Entry < Svnx::Base::Entry
14
42
  include Comparable
15
43
 
16
- attr_reader :commit_revision
17
44
  attr_reader :name
18
45
  attr_reader :path
19
- attr_reader :status
20
- attr_reader :status_revision
46
+ attr_reader :working_copy
21
47
 
22
48
  def initialize xmlelement, rootpath: nil
23
49
  @rootpath = rootpath
@@ -26,15 +52,12 @@ module Svnx::Status
26
52
 
27
53
  def set_from_element elmt
28
54
  set_attr_var elmt, 'path'
29
-
30
55
  wcstatus = elmt.at_xpath 'wc-status'
31
- @status = Svnx::Action.new wcstatus['item']
32
- set_attr_var wcstatus, 'status_revision', 'revision'
33
56
 
34
- commit = wcstatus.at_xpath 'commit'
35
- set_attr_var commit, 'commit_revision', 'revision'
36
57
  @name = @path.dup
37
58
 
59
+ @working_copy = WorkingCopy.new wcstatus
60
+
38
61
  if @rootpath
39
62
  # name is prefixed with directory unless '.' is used as the argument
40
63
  @name.sub! Regexp.new('^' + @rootpath), ''
@@ -11,8 +11,7 @@ end
11
11
  module Svnx::Update
12
12
  class Options < Svnx::Base::Options
13
13
  has :revision, :paths
14
- has_tag_argument "--depth", :depth
15
- has_tag_argument "--set-depth", :set_depth
14
+ has_tag_arguments :depth, :set_depth
16
15
  has_tag_field :ignore_externals
17
16
  end
18
17
  end
data/lib/svnx/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  module Svnx
5
5
  NAME = 'svnx'
6
- VERSION = '2.9.0'
6
+ VERSION = '2.11.0'
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.9.0
4
+ version: 2.11.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: 2019-08-25 00:00:00.000000000 Z
11
+ date: 2019-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: command-cacheable