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
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'svnx/base/action'
|
5
|
+
|
6
|
+
module Svnx
|
7
|
+
module Log
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Svnx::Log
|
12
|
+
class EntryPath
|
13
|
+
include Comparable
|
14
|
+
|
15
|
+
attr_reader :kind, :action, :name
|
16
|
+
|
17
|
+
def initialize args = Hash.new
|
18
|
+
@kind = args[:kind]
|
19
|
+
@action = args[:action]
|
20
|
+
@name = args[:name]
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_s
|
24
|
+
@name
|
25
|
+
end
|
26
|
+
|
27
|
+
def <=> other
|
28
|
+
name <=> other.name
|
29
|
+
end
|
30
|
+
|
31
|
+
def match? action, filter
|
32
|
+
@action.to_s == action.to_s && @name.start_with?(filter)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/svnx/log/options.rb
CHANGED
@@ -8,24 +8,20 @@ module Svnx
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
optargs << [ :verbose, "-v" ]
|
26
|
-
optargs << [ :revision, "-r" + revision.to_s ]
|
27
|
-
optargs << [ :url, url ]
|
28
|
-
optargs << [ :path, path ]
|
11
|
+
module Svnx::Log
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
FIELDS = [ :limit, :verbose, :revision, :url, :path ]
|
14
|
+
|
15
|
+
has_fields FIELDS
|
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
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
data/lib/svnx/merge/command.rb
CHANGED
data/lib/svnx/merge/options.rb
CHANGED
@@ -8,27 +8,22 @@ module Svnx
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
attr_reader :url
|
18
|
-
|
19
|
-
def initialize args = Hash.new
|
20
|
-
assign args, :url, :path, :accept, :range, :commit, :from
|
21
|
-
end
|
11
|
+
module Svnx::Merge
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
# FIELDS = [ :commit, :range, :accept, :from, :path, :url ]
|
14
|
+
FIELDS = [ :commit, :range, :accept, :from, :to ]
|
15
|
+
|
16
|
+
has_fields FIELDS
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
18
|
+
def options_to_args
|
19
|
+
# an array, not a hash, because "from" should be in the exec args before "url"/"path"
|
20
|
+
Array.new.tap do |a|
|
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
|
28
|
+
end
|
34
29
|
end
|
data/lib/svnx/project.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
+
require 'logue/loggable'
|
5
|
+
|
4
6
|
module Svnx
|
5
7
|
end
|
6
8
|
|
@@ -8,12 +10,17 @@ end
|
|
8
10
|
# entries (svnx/<command>/entry) or output. Enhances the low level functionality.
|
9
11
|
|
10
12
|
class Svnx::Project
|
13
|
+
include Logue::Loggable
|
14
|
+
|
11
15
|
attr_reader :dir
|
12
16
|
|
13
|
-
def initialize dir: nil, url: nil,
|
17
|
+
def initialize dir: nil, url: nil, cls: nil
|
14
18
|
@dir = dir
|
15
19
|
@url = url
|
16
|
-
@
|
20
|
+
@cls = cls
|
21
|
+
debug "dir: #{dir}"
|
22
|
+
debug "url: #{url}"
|
23
|
+
debug "cls: #{cls}"
|
17
24
|
end
|
18
25
|
|
19
26
|
def where
|
@@ -31,40 +38,45 @@ class Svnx::Project
|
|
31
38
|
info.path
|
32
39
|
end
|
33
40
|
|
34
|
-
def run_command cmdcls, cmdargs, args
|
35
|
-
|
36
|
-
cmd = cmdcls.new cmdargs, exec: exec
|
41
|
+
def run_command cmdcls, cmdargs, args
|
42
|
+
cmd = cmdcls.new cmdargs, cls: @cls
|
37
43
|
cmd.respond_to?(:entries) ? cmd.entries : cmd.output
|
38
44
|
end
|
39
45
|
|
40
46
|
def self.add_command_delegator name, takes_multiple_paths
|
41
47
|
require "svnx/#{name}/command"
|
42
48
|
|
43
|
-
pathargs =
|
49
|
+
pathargs = takes_multiple_paths ? "paths: [ @dir ]" : "path: @dir"
|
50
|
+
|
51
|
+
unless NOURL.include? name
|
52
|
+
pathargs << ", url: @url"
|
53
|
+
end
|
44
54
|
|
45
55
|
args = [
|
46
56
|
"Svnx::#{name.to_s.capitalize}::Command",
|
47
|
-
pathargs,
|
48
|
-
"args"
|
49
|
-
"exec: exec"
|
57
|
+
"{ " + pathargs + " }",
|
58
|
+
"**args"
|
50
59
|
]
|
51
|
-
|
60
|
+
|
52
61
|
src = [
|
53
|
-
"def #{name}
|
54
|
-
" run_command " + args.join(", "),
|
62
|
+
"def #{name} cls: nil, **args",
|
63
|
+
" run_command " + args.join(", ") + ", cls: @cls",
|
55
64
|
"end"
|
56
65
|
].join("\n")
|
66
|
+
|
57
67
|
module_eval src
|
58
68
|
end
|
59
69
|
|
70
|
+
NOURL = [ :diff, :update, :merge ]
|
71
|
+
|
60
72
|
add_command_delegator :info, false
|
61
73
|
|
62
74
|
add_command_delegator :update, true
|
63
|
-
add_command_delegator :merge, true
|
64
|
-
add_command_delegator :commit, true
|
65
75
|
|
76
|
+
add_command_delegator :commit, true
|
66
77
|
add_command_delegator :log, false
|
67
|
-
|
78
|
+
|
79
|
+
add_command_delegator :diff, true
|
68
80
|
add_command_delegator :propset, false
|
69
81
|
add_command_delegator :propget, false
|
70
82
|
|
data/lib/svnx/propget/command.rb
CHANGED
data/lib/svnx/propget/entries.rb
CHANGED
@@ -4,12 +4,14 @@
|
|
4
4
|
require 'svnx/propget/entry'
|
5
5
|
require 'svnx/base/entries'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
doc
|
10
|
-
|
7
|
+
module Svnx::Propget
|
8
|
+
class Entries < Svnx::Base::Entries
|
9
|
+
def get_elements doc
|
10
|
+
doc.elements['properties'].elements
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
def create_entry xmlelement
|
14
|
+
Entry.new :xmlelement => xmlelement
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
data/lib/svnx/propget/entry.rb
CHANGED
@@ -8,16 +8,18 @@ module Svnx
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
module Svnx::Propget
|
12
|
+
class Entry < Svnx::Base::Entry
|
13
|
+
attr_reader :path
|
14
|
+
attr_reader :name
|
15
|
+
attr_reader :value
|
16
|
+
|
17
|
+
def set_from_element elmt
|
18
|
+
set_attr_vars elmt, :path
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
prop = elmt.elements["property"]
|
21
|
+
set_attr_vars prop, :name
|
22
|
+
@value = prop.text
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
data/lib/svnx/propget/options.rb
CHANGED
@@ -8,24 +8,20 @@ module Svnx
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
attr_reader :path
|
17
|
-
|
18
|
-
def initialize args
|
19
|
-
assign args, :revision, :revprop, :name, :url, :path
|
20
|
-
end
|
11
|
+
module Svnx::Propget
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
FIELDS = [ :revision, :revprop, :name, :url, :path ]
|
14
|
+
|
15
|
+
has_fields FIELDS
|
21
16
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
17
|
+
def options_to_args
|
18
|
+
Array.new.tap do |a|
|
19
|
+
a << [ :revision, [ "-r", revision ] ]
|
20
|
+
a << [ :revprop, "--revprop" ]
|
21
|
+
a << [ :name, name ]
|
22
|
+
a << [ :url, url ]
|
23
|
+
a << [ :path, path ]
|
24
|
+
end
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
data/lib/svnx/propset/command.rb
CHANGED
data/lib/svnx/propset/options.rb
CHANGED
@@ -8,26 +8,21 @@ module Svnx
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
attr_reader :url
|
17
|
-
attr_reader :path
|
18
|
-
|
19
|
-
def initialize args
|
20
|
-
assign args, :file, :revision, :name, :value, :url, :path
|
21
|
-
end
|
11
|
+
module Svnx::Propset
|
12
|
+
class Options < Svnx::Base::Options
|
13
|
+
FIELDS = [ :file, :revision, :name, :value, :url, :path ]
|
14
|
+
|
15
|
+
has_fields FIELDS
|
22
16
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
17
|
+
def options_to_args
|
18
|
+
Array.new.tap do |a|
|
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
|
31
26
|
end
|
32
27
|
end
|
33
28
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
module Svnx
|
4
|
+
module Svnx
|
5
|
+
module Revision
|
6
|
+
RELATIVE_REVISION_RE = Regexp.new '^([\+\-])(\d+)$'
|
7
|
+
end
|
8
|
+
end
|
5
9
|
|
6
|
-
module Svnx::Revision
|
10
|
+
module Svnx::Revision
|
7
11
|
class ArgumentFactory
|
8
12
|
include Logue::Loggable
|
9
13
|
|
@@ -6,21 +6,24 @@ require 'svnx/revision/error'
|
|
6
6
|
require 'logue/loggable'
|
7
7
|
require 'svnx/revision/argfactory'
|
8
8
|
|
9
|
-
module Svnx; module Revision; end; end
|
10
|
-
|
11
9
|
# We represent what svn calls a revision (-r134:{2010-1-1}) as a Range,
|
12
10
|
# consisting of a from and to (optional) Argument.
|
11
|
+
|
12
|
+
module Svnx
|
13
|
+
module Revision
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
13
17
|
module Svnx::Revision
|
14
|
-
RELATIVE_REVISION_RE = Regexp.new '^([\+\-])(\d+)$'
|
15
|
-
|
16
|
-
# Returns the Nth revision from the given logging output.
|
17
|
-
|
18
|
-
# -n means to count from the end of the list.
|
19
|
-
# +n means to count from the beginning of the list.
|
20
|
-
# n means the literal revision number.
|
21
18
|
class Argument
|
22
19
|
include Logue::Loggable, Comparable
|
23
20
|
|
21
|
+
# Returns the Nth revision from the given logging output.
|
22
|
+
|
23
|
+
# -n means to count from the end of the list.
|
24
|
+
# +n means to count from the beginning of the list.
|
25
|
+
# n means the literal revision number.
|
26
|
+
|
24
27
|
# these are also valid revisions
|
25
28
|
# :working_copy
|
26
29
|
# :head
|
@@ -42,27 +45,27 @@ module Svnx::Revision
|
|
42
45
|
end
|
43
46
|
|
44
47
|
def <=> other
|
45
|
-
|
46
|
-
@value <=> other.value
|
47
|
-
else
|
48
|
-
@value <=> other
|
49
|
-
end
|
48
|
+
@value <=> (other.kind_of?(Argument) ? other.value : other)
|
50
49
|
end
|
51
50
|
end
|
51
|
+
end
|
52
52
|
|
53
|
+
module Svnx::Revision
|
53
54
|
class IndexArgument < Argument
|
54
55
|
end
|
56
|
+
end
|
55
57
|
|
58
|
+
module Svnx::Revision
|
56
59
|
class StringArgument < Argument
|
57
60
|
end
|
61
|
+
end
|
58
62
|
|
59
|
-
|
60
|
-
|
63
|
+
# this is of the form -3, which is revision[-3] (second one from the most
|
64
|
+
# recent; -1 is the most recent).
|
65
|
+
module Svnx::Revision
|
61
66
|
class RelativeArgument < IndexArgument
|
62
67
|
def initialize value, args
|
63
|
-
entries = args[:entries]
|
64
|
-
|
65
|
-
unless entries
|
68
|
+
unless entries = args[:entries]
|
66
69
|
raise RevisionError.new "cannot determine relative revision without entries"
|
67
70
|
end
|
68
71
|
|