pvn 0.0.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.
Files changed (99) hide show
  1. data/README.markdown +38 -0
  2. data/bin/pvn +12 -0
  3. data/bin/pvndiff +10 -0
  4. data/lib/pvn/app.rb +144 -0
  5. data/lib/pvn/base/textlines.rb +35 -0
  6. data/lib/pvn/base/util.rb +14 -0
  7. data/lib/pvn/cmddoc.rb +77 -0
  8. data/lib/pvn/config.rb +65 -0
  9. data/lib/pvn/describe.rb +40 -0
  10. data/lib/pvn/diff/diffcmd.rb +49 -0
  11. data/lib/pvn/diff/differ.rb +67 -0
  12. data/lib/pvn/diff/diffopts.rb +58 -0
  13. data/lib/pvn/doc.rb +34 -0
  14. data/lib/pvn/io/element.rb +113 -0
  15. data/lib/pvn/io/fselement.rb +22 -0
  16. data/lib/pvn/log/formatter/color_formatter.rb +29 -0
  17. data/lib/pvn/log/formatter/entries_formatter.rb +33 -0
  18. data/lib/pvn/log/formatter/entry_formatter.rb +57 -0
  19. data/lib/pvn/log/formatter/log_formatter.rb +59 -0
  20. data/lib/pvn/log/formatter/message_formatter.rb +19 -0
  21. data/lib/pvn/log/formatter/path_formatter.rb +41 -0
  22. data/lib/pvn/log/formatter/summary_formatter.rb +49 -0
  23. data/lib/pvn/log/logcmd.rb +136 -0
  24. data/lib/pvn/log/logentry.rb +116 -0
  25. data/lib/pvn/log/logfactory.rb +101 -0
  26. data/lib/pvn/log/logoptions.rb +43 -0
  27. data/lib/pvn/pct/linecount.rb +33 -0
  28. data/lib/pvn/pct/pctcmd.rb +204 -0
  29. data/lib/pvn/pct/statcmd.rb +13 -0
  30. data/lib/pvn/revision/entry.rb +94 -0
  31. data/lib/pvn/revision.rb +119 -0
  32. data/lib/pvn/subcommands/base/clargs.rb +53 -0
  33. data/lib/pvn/subcommands/base/command.rb +60 -0
  34. data/lib/pvn/subcommands/base/doc.rb +94 -0
  35. data/lib/pvn/subcommands/base/options.rb +22 -0
  36. data/lib/pvn/subcommands/log/command.rb +70 -0
  37. data/lib/pvn/subcommands/log/options.rb +43 -0
  38. data/lib/pvn/subcommands/pct/clargs.rb +33 -0
  39. data/lib/pvn/subcommands/pct/command.rb +57 -0
  40. data/lib/pvn/subcommands/revision/multiple_revisions_option.rb +43 -0
  41. data/lib/pvn/subcommands/revision/revision_option.rb +74 -0
  42. data/lib/pvn/subcommands/revision/revision_regexp_option.rb +39 -0
  43. data/lib/pvn/svn/command/svncmd.rb +39 -0
  44. data/lib/pvn/svn/environment.rb +23 -0
  45. data/lib/pvn/svn/svnelement.rb +89 -0
  46. data/lib/pvn/svn/svninfo.rb +42 -0
  47. data/lib/pvn/svn/svnroot.rb +29 -0
  48. data/lib/pvn/upp/uppcmd.rb +112 -0
  49. data/lib/pvn/wherecmd.rb +55 -0
  50. data/lib/pvn.rb +8 -0
  51. data/lib/svnx/command.rb +60 -0
  52. data/lib/svnx/entry.rb +34 -0
  53. data/lib/svnx/info/command.rb +21 -0
  54. data/lib/svnx/info/entries.rb +27 -0
  55. data/lib/svnx/info/entry.rb +34 -0
  56. data/lib/svnx/log/command.rb +93 -0
  57. data/lib/svnx/log/entries.rb +57 -0
  58. data/lib/svnx/log/entry.rb +54 -0
  59. data/lib/svnx/status/command.rb +21 -0
  60. data/lib/svnx/status/entries.rb +22 -0
  61. data/lib/svnx/status/entry.rb +33 -0
  62. data/lib/synoption/base_option.rb +149 -0
  63. data/lib/synoption/boolean_option.rb +21 -0
  64. data/lib/synoption/doc.rb +81 -0
  65. data/lib/synoption/fixnum_option.rb +13 -0
  66. data/lib/synoption/match.rb +47 -0
  67. data/lib/synoption/option.rb +10 -0
  68. data/lib/synoption/optionable.rb +66 -0
  69. data/lib/synoption/set.rb +114 -0
  70. data/lib/system/cachecmd.rb +65 -0
  71. data/lib/system/cmdexec.rb +13 -0
  72. data/lib/system/cmdline.rb +70 -0
  73. data/lib/system/command/arg.rb +12 -0
  74. data/lib/system/command/cachefile.rb +39 -0
  75. data/lib/system/command/caching.rb +36 -0
  76. data/lib/system/command/line.rb +47 -0
  77. data/lib/system/command.rb +72 -0
  78. data/test/integration/svnx/log/test.rb +43 -0
  79. data/test/unit/pvn/app_test.rb +22 -0
  80. data/test/unit/pvn/io/element/log/log_test.rb +35 -0
  81. data/test/unit/pvn/log/formatter/entry_formatter_test.rb +90 -0
  82. data/test/unit/pvn/revision/entry_test.rb +123 -0
  83. data/test/unit/pvn/subcommands/log/command_test.rb +22 -0
  84. data/test/unit/pvn/subcommands/log/options_test.rb +85 -0
  85. data/test/unit/pvn/subcommands/revision/multiple_revisions_option_test.rb +67 -0
  86. data/test/unit/pvn/subcommands/revision/revision_option_test.rb +57 -0
  87. data/test/unit/pvn/subcommands/revision/revision_regexp_option_test.rb +69 -0
  88. data/test/unit/svnx/info/entry_test.rb +52 -0
  89. data/test/unit/svnx/log/cmargs_test.rb +22 -0
  90. data/test/unit/svnx/log/entries_test.rb +73 -0
  91. data/test/unit/svnx/log/entry_test.rb +21 -0
  92. data/test/unit/svnx/status/entry_test.rb +39 -0
  93. data/test/unit/synoption/base_option_test.rb +182 -0
  94. data/test/unit/synoption/match_test.rb +61 -0
  95. data/test/unit/synoption/option_test.rb +15 -0
  96. data/test/unit/synoption/set_test.rb +37 -0
  97. data/test/unit/system/command/caching_test.rb +97 -0
  98. data/test/unit/system/command/line_test.rb +33 -0
  99. metadata +199 -0
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'riel'
6
+
7
+ module SVN
8
+ # Info has the results of "svn info <file>", where the values returned are
9
+ # keys and values in a Hash.
10
+ class Info < Hash
11
+ include Loggable
12
+
13
+ def initialize args
14
+ RIEL::Log.info "args: #{args}".green
15
+ @name = args[:name]
16
+ super()
17
+
18
+ execute
19
+ end
20
+
21
+ def execute
22
+ cmd = "svn info #{@name}"
23
+ output = %x{#{cmd}}
24
+
25
+ kv_re = Regexp.new '^(.*?):\s*(.*)'
26
+
27
+ info = Hash.new
28
+ output.split("\n").each do |line|
29
+ key, value = kv_re.match(line)[1, 2]
30
+
31
+ # debug "key: #{key}"
32
+ # debug "value: #{value}"
33
+
34
+ keysym = key.downcase.gsub(' ', '_').to_sym
35
+ # debug "keysym: #{keysym}"
36
+
37
+ self[keysym] = value
38
+ end
39
+ info
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'riel'
6
+
7
+ module PVN
8
+ class SVNRootElement < SVNElement
9
+ include Loggable
10
+ attr_reader :name
11
+
12
+ # returns the topmost directory for the repo root of the given (defaulting
13
+ # to current) directory
14
+ def self.new dirname = '.'
15
+ dir = Pathname.new(dirname).expand_path
16
+
17
+ while dir.to_s != '/'
18
+ elmt = SVNElement.new :name => dir
19
+ elmtinfo = elmt.info
20
+ return elmt if elmtinfo[:repository_root] == elmtinfo[:url]
21
+ return elmt if !(dir.parent + '.svn').exist?
22
+ return nil if elmtinfo[:repository_root].nil?
23
+ dir += '..'
24
+ end
25
+
26
+ nil
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'system/command'
5
+
6
+ module PVN
7
+ class UppOptionSet < OptionSet
8
+ attr_accessor :revision
9
+
10
+ def initialize
11
+ super
12
+ # @revision = add RevisionOption.new
13
+ end
14
+ end
15
+
16
+ class UppCommand < Command
17
+ DEFAULT_LIMIT = 5
18
+ COMMAND = "upp"
19
+
20
+ self.doc do |doc|
21
+ doc.subcommands = [ COMMAND ]
22
+ doc.description = "Updates the local repository, in parallel for speed."
23
+ doc.usage = ""
24
+ doc.summary = [ "Updates the local repository, using parallel tasks. This is",
25
+ "signficantly faster () for projects with multiple",
26
+ "subprojects defined as externals." ]
27
+ doc.examples << [ "pvn upp", "Updates the local repository." ]
28
+ end
29
+
30
+ def initialize args
31
+ # insanely simple
32
+
33
+ externals = get_all_externals
34
+
35
+ upcmds = Array.new
36
+ externals.each do |ext|
37
+ puts "ext: #{ext}"
38
+ upcmds << "cd #{ext} && svn up 2>&1"
39
+ end
40
+
41
+ upcmds << "svn up --ignore-externals . 2>&1"
42
+
43
+ cmds_to_threads = upcmds.map do |upcmd|
44
+ thr = Thread.new do
45
+ IO.popen(upcmd) do |io|
46
+ io.readlines
47
+ end
48
+ end
49
+ [ upcmd, thr ]
50
+ end
51
+
52
+ cmds_to_threads.each do |cmd, thread|
53
+ puts cmd
54
+ puts thread.value
55
+ end
56
+ end
57
+
58
+ def external_to_local fd, line
59
+ # spaces?
60
+ local, url = line.split
61
+
62
+ # I've seen externals defined "backwards" (local url)
63
+ if local.index(%r{\w+://})
64
+ url, local = local, url
65
+ end
66
+
67
+ fd + "/" + local
68
+ end
69
+
70
+ def get_externals fd
71
+ externals = Array.new
72
+ pgcmd = "svn pg #{fd}"
73
+ IO.popen(pgcmd) do |io|
74
+ io.each do |line|
75
+ next if line.strip.empty?
76
+
77
+ # spaces?
78
+ local, url = line.split
79
+
80
+ # I've seen externals defined "backwards" (local url)
81
+ if local.index(%r{\w+://})
82
+ url, local = local, url
83
+ end
84
+
85
+ externals << "#{fd}/#{local}"
86
+ end
87
+ end
88
+
89
+ externals
90
+ end
91
+
92
+ def get_all_externals
93
+ externals = Array.new
94
+
95
+ # get properties list (this could probably be cached, but it's relatively fast)
96
+ proplistcmd = "svn pl -R"
97
+ fd = nil
98
+ fdre = Regexp.new '^Properties on \'(.*)\':$'
99
+ extre = Regexp.new '^\s*svn:externals$'
100
+ IO.popen(proplistcmd) do |io|
101
+ io.each do |line|
102
+ if md = fdre.match(line)
103
+ fd = md[1]
104
+ elsif fd && extre.match(line)
105
+ externals.concat get_externals(fd)
106
+ end
107
+ end
108
+ end
109
+ externals
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'riel'
6
+ require 'system/command'
7
+ require 'pvn/io/fselement'
8
+ require 'pvn/svn/svnelement'
9
+ require 'pvn/svn/svnroot'
10
+ require 'pvn/io/element'
11
+
12
+ module PVN
13
+ class WhereOptionSet < OptionSet
14
+ attr_accessor :revision
15
+
16
+ def initialize
17
+ super
18
+ # @revision = add RevisionRegexpOption.new
19
+ end
20
+ end
21
+
22
+ class WhereCommand < Command
23
+ DEFAULT_LIMIT = 5
24
+ COMMAND = "where"
25
+
26
+ self.doc do |doc|
27
+ doc.subcommands = [ COMMAND ]
28
+ doc.description = "Shows the Subversion mapping from the given URL or file."
29
+ doc.usage = "[OPTIONS] [FILE|URL]..."
30
+ doc.summary = [ "Shows the Subversion mapping from the URL or file. If the ",
31
+ "argument is a URL, then the local file/directory is displayed.",
32
+ "If the argument is a file, then the URL for the Subversion",
33
+ "repository is printed." ]
34
+ # doc.examples << [ "pvn pct main.c", "Prints the number of lines and percentage by which main.c has changed." ]
35
+ end
36
+
37
+ def initialize args
38
+ # not calling super, since all of our stuff goes on in this ctor.
39
+
40
+ args[:command_args].each do |arg|
41
+ info "arg: #{arg}".on_black
42
+
43
+ if arg.index(%r{^\w+:\/\/})
44
+ info "url: #{arg}".on_red
45
+ else
46
+ info "file: #{arg}".red
47
+ el = Element.new :file => arg
48
+ info "el: #{el}"
49
+ info "el.local: #{el.local}"
50
+ info "el.svn: #{el.svn}"
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
data/lib/pvn.rb ADDED
@@ -0,0 +1,8 @@
1
+ fdirname = File.dirname(__FILE__)
2
+
3
+ $:.unshift(fdirname) unless
4
+ $:.include?(fdirname) || $:.include?(File.expand_path(fdirname))
5
+
6
+ module PVN
7
+ VERSION = '0.0.1'
8
+ end
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'riel'
6
+ require 'system/command/line'
7
+
8
+ # this replaces svnx/lib/command/svncommand.
9
+
10
+ module SVNx
11
+ class CommandLine < System::CommandLine
12
+ def initialize subcmd, args = Array.new
13
+ info "args: #{args}"
14
+ cmdargs = [ 'svn', subcmd, '--xml' ].concat args
15
+ info "cmdargs: #{cmdargs}"
16
+ super cmdargs
17
+ end
18
+ end
19
+
20
+ class CachingCommandLine < System::CachingCommandLine
21
+ def initialize subcmd, args = Array.new
22
+ info "args: #{args}"
23
+ cmdargs = [ 'svn', subcmd, '--xml' ].concat args
24
+ info "cmdargs: #{cmdargs}"
25
+ super cmdargs
26
+ end
27
+ end
28
+
29
+ class CommandArgs
30
+ attr_accessor :path
31
+
32
+ def initialize args = Hash.new
33
+ @path = args[:path]
34
+ end
35
+
36
+ def to_a
37
+ [ @path ].compact
38
+ end
39
+ end
40
+
41
+ class Command
42
+ include Loggable
43
+
44
+ attr_reader :output
45
+
46
+ def initialize args
47
+ @args = args
48
+ end
49
+
50
+ def command_line
51
+ raise "must be implemented"
52
+ end
53
+
54
+ def execute
55
+ cmdline = command_line
56
+ cmdline.execute
57
+ @output = cmdline.output
58
+ end
59
+ end
60
+ end
data/lib/svnx/entry.rb ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'riel'
6
+ require 'rexml/document'
7
+
8
+ module SVNx
9
+ class Entry
10
+ include Loggable
11
+
12
+ def get_attribute xmlelement, attrname
13
+ xmlelement.attributes[attrname]
14
+ end
15
+
16
+ def get_element_text xmlelement, elmtname
17
+ elmt = xmlelement.elements[elmtname]
18
+ # in my test svn repository, revision 1 doesn't have an author element:
19
+ (elmt && elmt.text) || ""
20
+ end
21
+
22
+ def set_attr_var xmlelement, varname
23
+ set_var varname, get_attribute(xmlelement, varname)
24
+ end
25
+
26
+ def set_elmt_var xmlelement, varname
27
+ set_var varname, get_element_text(xmlelement, varname)
28
+ end
29
+
30
+ def set_var varname, value
31
+ instance_variable_set '@' + varname, value
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'svnx/command'
5
+
6
+ module SVNx
7
+ class InfoCommandLine < CommandLine
8
+ def initialize args = Array.new
9
+ super "info", args
10
+ end
11
+ end
12
+
13
+ class InfoCommandArgs < CommandArgs
14
+ end
15
+
16
+ class InfoCommand < Command
17
+ def command_line
18
+ InfoCommandLine.new @cmdargs
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ # require 'svnx/info/entry'
5
+
6
+ module SVNx; module Info; end; end
7
+
8
+ module SVNx::Info
9
+ class Entries < Array
10
+ include Loggable
11
+
12
+ def initialize args = Hash.new
13
+ if xmllines = args[:xmllines]
14
+ doc = REXML::Document.new xmllines
15
+
16
+ # xxx
17
+ doc.elements.each('xxx') do |entryelement|
18
+ self << Entry.new(:xmlelement => entryelement)
19
+ end
20
+ elsif xml = args[:xml]
21
+ xml.xmlentries.each do |xmlentry|
22
+ self << Entry.new(:xmlentry => xmlentry)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'svnx/entry'
5
+
6
+ module SVNx; module Info; end; end
7
+
8
+ module SVNx::Info
9
+ class Entry < SVNx::Entry
10
+ attr_reader :url
11
+ attr_reader :root
12
+ attr_reader :kind
13
+ attr_reader :path
14
+
15
+ def initialize args = Hash.new
16
+ if xmllines = args[:xmllines]
17
+ doc = REXML::Document.new xmllines
18
+ entry = doc.elements['info/entry']
19
+
20
+ set_attr_var entry, 'kind'
21
+ set_attr_var entry, 'path'
22
+ set_elmt_var entry, 'url'
23
+
24
+ repo = entry.elements['repository']
25
+ # set_elmt_var doc, 'info/entry/repository/root'
26
+ set_elmt_var repo, 'root'
27
+ else
28
+ raise "must be initialized with xmllines"
29
+ end
30
+
31
+ info "self: #{self.inspect}"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'rubygems'
5
+ require 'riel'
6
+ require 'system/command/line'
7
+ require 'system/command/caching'
8
+ require 'pvn/svn/environment'
9
+ require 'svnx/command'
10
+
11
+ module SVNx
12
+ CACHE_DIR = "/tmp/cache_dir_for_log_command"
13
+
14
+ class LogOptions
15
+ attr_reader :revision
16
+ end
17
+
18
+ class LogCommandLine < CommandLine
19
+ def initialize args = Array.new
20
+ super "log", args.to_a
21
+ end
22
+ end
23
+
24
+ class LogCommandLineCaching < CachingCommandLine
25
+ def initialize args = Array.new
26
+ super "log", args.to_a
27
+ end
28
+
29
+ def cache_dir
30
+ PVN::Environment.instance.cache_dir
31
+ end
32
+ end
33
+
34
+ class LogCommandArgs < CommandArgs
35
+ include Loggable
36
+
37
+ attr_reader :limit
38
+ attr_reader :verbose
39
+ attr_reader :revision
40
+ attr_reader :use_cache
41
+
42
+ def initialize args = Hash.new
43
+ @limit = args[:limit]
44
+ @verbose = args[:verbose]
45
+ @use_cache = args[:use_cache].nil? || args[:use_cache]
46
+ @revision = args[:revision]
47
+ info "args : #{args}"
48
+ info "@limit : #{@limit}"
49
+ info "@verbose : #{@verbose}"
50
+ info "@use_cache: #{@use_cache}"
51
+ info "@revision : #{@revision}"
52
+ super
53
+ end
54
+
55
+ def to_a
56
+ ary = Array.new
57
+ if @limit
58
+ ary << '--limit' << @limit
59
+ end
60
+ if @verbose
61
+ ary << '-v'
62
+ end
63
+
64
+ if @revision
65
+ @revision.each do |rev|
66
+ ary << "-r#{rev}"
67
+ end
68
+ end
69
+
70
+ if @path
71
+ ary << @path
72
+ end
73
+
74
+ ary.compact
75
+ end
76
+ end
77
+
78
+ class LogCommand < Command
79
+ def initialize args
80
+ info "args.to_a: #{args.to_a}"
81
+ @use_cache = args.use_cache
82
+ info "@use_cache: #{@use_cache}"
83
+ super
84
+ end
85
+
86
+ def command_line
87
+ info "@args: #{@args}"
88
+ cmdline = @use_cache ? LogCommandLineCaching.new(@args) : LogCommandLine.new(@args)
89
+ info "cmdline: #{cmdline}"
90
+ cmdline
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'svnx/log/entry'
5
+ require 'rexml/document'
6
+
7
+ module SVNx::Log
8
+ class Entries
9
+ include Loggable, Enumerable
10
+
11
+ def initialize args = Hash.new
12
+ @entries = Hash.new
13
+
14
+ if xmllines = args[:xmllines]
15
+ # this is preferred
16
+
17
+ if xmllines.kind_of? Array
18
+ xmllines = xmllines.join ''
19
+ end
20
+
21
+ doc = REXML::Document.new xmllines
22
+
23
+ @logelements = doc.elements['log'].elements
24
+ @size = @logelements.size
25
+ elsif xmlentries = args[:xmlentries]
26
+ # this is legacy:
27
+
28
+ xmlentries.each do |xmlentry|
29
+ @entries[@entries.size] = Entry.new(:xmlentry => xmlentry)
30
+ end
31
+ end
32
+ end
33
+
34
+ def [] idx
35
+ @entries[idx] ||= Entry.new(:xmlelement => @logelements[idx + 1])
36
+ end
37
+
38
+ def size
39
+ @size
40
+ end
41
+
42
+ def each(&blk)
43
+ # all elements must be processed before this can happen:
44
+ if @logelements
45
+ @logelements.each_with_index do |logelement, idx|
46
+ # info "logelement: #{logelement}"
47
+ # info "idx: #{idx}"
48
+ @entries[idx] ||= Entry.new(:xmlelement => logelement)
49
+ end
50
+
51
+ @logelements = nil
52
+ end
53
+
54
+ @entries.keys.sort.collect { |idx| @entries[idx] }.each(&blk)
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'svnx/entry'
5
+
6
+ module SVNx; module Log; end; end
7
+
8
+ module SVNx::Log
9
+ class Entry < SVNx::Entry
10
+
11
+ attr_reader :revision, :author, :date, :paths, :msg
12
+
13
+ def initialize args = Hash.new
14
+ # this is log/logentry from "svn log --xml"
15
+ if xmlelement = args[:xmlelement]
16
+ set_attr_var xmlelement, 'revision'
17
+
18
+ %w{ author date msg }.each do |field|
19
+ set_elmt_var xmlelement, field
20
+ end
21
+
22
+ @paths = Array.new
23
+
24
+ xmlelement.elements.each('paths/path') do |pe|
25
+ kind = get_attribute pe, 'kind'
26
+ action = get_attribute pe, 'action'
27
+ name = pe.text
28
+
29
+ @paths << LogEntryPath.new(:kind => kind, :action => action, :name => name)
30
+ end
31
+ else
32
+ @revision = args[:revision]
33
+ @author = args[:author]
34
+ @date = args[:date]
35
+ @paths = args[:paths]
36
+ @message = args[:message]
37
+ end
38
+ end
39
+
40
+ def message
41
+ @msg
42
+ end
43
+ end
44
+
45
+ class LogEntryPath
46
+ attr_reader :kind, :action, :name
47
+
48
+ def initialize args = Hash.new
49
+ @kind = args[:kind]
50
+ @action = args[:action]
51
+ @name = args[:name]
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'svnx/command'
5
+
6
+ module SVNx
7
+ class StatusCommandLine < CommandLine
8
+ def initialize args = Array.new
9
+ super "status", args
10
+ end
11
+ end
12
+
13
+ class StatusCommandArgs < CommandArgs
14
+ end
15
+
16
+ class StatusCommand < Command
17
+ def command_line
18
+ StatusCommandLine.new @cmdargs
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby -w
2
+ # -*- ruby -*-
3
+
4
+ require 'svnx/status/entry'
5
+
6
+ module SVNx::Status
7
+ class Entries < Array
8
+ include Loggable
9
+
10
+ def initialize args = Hash.new
11
+ super()
12
+
13
+ raise "not implemented"
14
+
15
+ if xmlentries = args[:xml]
16
+ xmlentries.each do |xmlentry|
17
+ self << Entry.new(:xml => xmlentry)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end