pvn 0.0.7 → 0.0.8
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.
- data/bin/change.rb +50 -0
- data/bin/pvn +8 -4
- data/bin/quote.rb +18 -6
- data/bin/quotes.orig.txt +145 -0
- data/bin/quotes.txt +64 -0
- data/lib/pvn/app/runner.rb +103 -0
- data/lib/pvn/app.rb +1 -142
- data/lib/pvn/{subcommands/base → command}/color_option.rb +1 -1
- data/lib/pvn/{subcommands/base → command}/command.rb +10 -6
- data/lib/pvn/{subcommands/base → command}/doc.rb +2 -2
- data/lib/pvn/{subcommands/base → command}/options.rb +2 -2
- data/lib/pvn/config.rb +14 -1
- data/lib/pvn/{subcommands/diff → diff}/command.rb +6 -6
- data/lib/pvn/diff/differ.rb +60 -44
- data/lib/pvn/diff/local_differ.rb +99 -0
- data/lib/pvn/diff/log_paths.rb +46 -0
- data/lib/pvn/{subcommands/diff → diff}/options.rb +8 -6
- data/lib/pvn/diff/path.rb +52 -0
- data/lib/pvn/diff/path_revision.rb +31 -0
- data/lib/pvn/diff/paths.rb +42 -0
- data/lib/pvn/diff/repository_differ.rb +154 -0
- data/lib/pvn/diff/revision.rb +36 -0
- data/lib/pvn/diff/status_paths.rb +87 -0
- data/lib/pvn/io/element.rb +29 -8
- data/lib/pvn/{subcommands/log → log}/command.rb +4 -4
- data/lib/pvn/log/formatter/log_formatter.rb +1 -1
- data/lib/pvn/{subcommands/log → log}/options.rb +7 -7
- data/lib/pvn/{subcommands/pct → pct}/command.rb +6 -6
- data/lib/pvn/{subcommands/pct → pct}/diffcount.rb +1 -1
- data/lib/pvn/{subcommands/pct → pct}/differ.rb +2 -2
- data/lib/pvn/{subcommands/pct → pct}/local_differ.rb +3 -3
- data/lib/pvn/pct/options.rb +12 -0
- data/lib/pvn/{subcommands/pct → pct}/repository_differ.rb +5 -13
- data/lib/pvn/revision/{entry.rb → argument.rb} +45 -30
- data/lib/pvn/{subcommands/revision → revision}/base_option.rb +2 -2
- data/lib/pvn/revision/error.rb +11 -0
- data/lib/pvn/{subcommands/revision → revision}/multiple_revisions_option.rb +1 -1
- data/lib/pvn/revision/range.rb +49 -0
- data/lib/pvn/{subcommands/revision → revision}/revision_option.rb +1 -8
- data/lib/pvn/{subcommands/revision → revision}/revision_regexp_option.rb +2 -2
- data/lib/pvn/{subcommands/status → status}/command.rb +6 -6
- data/lib/pvn/status/formatter/status_formatter.rb +1 -1
- data/lib/pvn/status/options.rb +12 -0
- data/lib/pvn/{base/util.rb → util/array.rb} +2 -1
- data/lib/pvn.rb +1 -6
- data/lib/svnx/action.rb +52 -0
- data/lib/svnx/entries.rb +9 -1
- data/lib/svnx/log/command.rb +4 -3
- data/lib/svnx/status/entry.rb +30 -13
- data/lib/synoption/base_option.rb +10 -27
- data/lib/synoption/matchers.rb +22 -0
- data/lib/system/command/cachefile.rb +28 -14
- data/lib/system/command.rb +1 -1
- data/test/integration/pvn/diff/command_test.rb +20 -0
- data/test/integration/pvn/diff/local_differ_test.rb +72 -0
- data/test/integration/pvn/diff/log_paths_test.rb +28 -0
- data/test/integration/pvn/diff/repository_differ_test.rb +127 -0
- data/test/integration/pvn/diff/status_paths_test.rb +31 -0
- data/test/integration/pvn/log/command_test.rb +29 -0
- data/test/integration/pvn/pct/command_test.rb +30 -0
- data/test/integration/pvn/status/command_test.rb +26 -0
- data/test/unit/pvn/app_test.rb +7 -5
- data/test/unit/pvn/diff/path_revision_test.rb +45 -0
- data/test/unit/pvn/diff/path_test.rb +38 -0
- data/test/unit/pvn/diff/revision_test.rb +35 -0
- data/test/unit/pvn/io/element/log/log_test.rb +2 -2
- data/test/unit/pvn/log/formatter/entry_formatter_test.rb +40 -29
- data/test/unit/pvn/{subcommands/log → log}/options_test.rb +4 -4
- data/test/unit/pvn/revision/argument_test.rb +157 -0
- data/test/unit/pvn/{subcommands/revision → revision}/multiple_revisions_option_test.rb +10 -11
- data/test/unit/pvn/revision/range_test.rb +26 -0
- data/test/unit/pvn/{subcommands/revision → revision}/revision_option_test.rb +13 -18
- data/test/unit/pvn/{subcommands/revision → revision}/revision_regexp_option_test.rb +8 -10
- data/test/unit/svnx/action_test.rb +67 -0
- data/test/unit/svnx/info/entries_test.rb +10 -10
- data/test/unit/svnx/info/entry_test.rb +7 -10
- data/test/unit/svnx/log/entries_test.rb +31 -29
- data/test/unit/svnx/log/entry_test.rb +3 -7
- data/test/unit/svnx/status/entries_test.rb +7 -6
- data/test/unit/svnx/status/entry_test.rb +2 -23
- data/test/unit/system/command/cachefile_test.rb +53 -0
- data/test/unit/system/command/caching_test.rb +14 -23
- metadata +83 -64
- data/lib/pvn/describe.rb +0 -40
- data/lib/pvn/diff/diffcmd.rb +0 -49
- data/lib/pvn/diff/diffopts.rb +0 -58
- data/lib/pvn/log/logcmd.rb +0 -135
- data/lib/pvn/log/logentry.rb +0 -116
- data/lib/pvn/log/logfactory.rb +0 -101
- data/lib/pvn/log/logoptions.rb +0 -43
- data/lib/pvn/revision.rb +0 -119
- data/lib/pvn/subcommands/diff/differ.rb +0 -65
- data/lib/pvn/subcommands/diff/local_differ.rb +0 -103
- data/lib/pvn/subcommands/diff/repository_differ.rb +0 -145
- data/lib/pvn/subcommands/pct/clargs.rb +0 -33
- data/lib/pvn/subcommands/pct/options.rb +0 -12
- data/lib/pvn/subcommands/status/options.rb +0 -12
- data/lib/pvn/svn/command/svncmd.rb +0 -39
- data/lib/pvn/svn/environment.rb +0 -23
- data/lib/pvn/svn/svnelement.rb +0 -89
- data/lib/pvn/svn/svninfo.rb +0 -42
- data/lib/pvn/svn/svnroot.rb +0 -29
- data/lib/pvn/upp/uppcmd.rb +0 -112
- data/lib/pvn/wherecmd.rb +0 -55
- data/test/integration/pvn/subcommands/diff/command_test.rb +0 -153
- data/test/integration/pvn/subcommands/log/command_test.rb +0 -22
- data/test/integration/svnx/log/test.rb +0 -43
- data/test/unit/pvn/revision/entry_test.rb +0 -110
- /data/lib/pvn/{subcommands/base → command}/clargs.rb +0 -0
- /data/lib/pvn/{base → util}/color_formatter.rb +0 -0
- /data/lib/pvn/{base → util}/textlines.rb +0 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'pvn/io/element'
|
5
|
+
require 'pvn/diff/path'
|
6
|
+
require 'pvn/diff/paths'
|
7
|
+
|
8
|
+
module PVN::Diff
|
9
|
+
# represents the log entries from one revision through another.
|
10
|
+
class StatusPaths < Paths
|
11
|
+
include Loggable
|
12
|
+
|
13
|
+
def add_for_path path
|
14
|
+
pathelmt = PVN::IO::Element.new :local => path
|
15
|
+
pathinfo = pathelmt.get_info
|
16
|
+
elmt = PVN::IO::Element.new :local => path
|
17
|
+
add elmt, pathinfo.url
|
18
|
+
end
|
19
|
+
|
20
|
+
def add elmt, url
|
21
|
+
status = elmt.find_files_by_status
|
22
|
+
info "status: #{status}"
|
23
|
+
status.entries.each do |entry|
|
24
|
+
# we don't care about unversioned entries for diffing.
|
25
|
+
next if entry.status == 'unversioned'
|
26
|
+
|
27
|
+
info "@revision: #{@revision}"
|
28
|
+
info "entry: #{entry}"
|
29
|
+
# svn log prepends /; svn status does not
|
30
|
+
name = '/' + entry.path
|
31
|
+
info "name: #{name}"
|
32
|
+
rev = :working_copy
|
33
|
+
info "rev: #{rev}"
|
34
|
+
|
35
|
+
# what Status::Entry calls a status, we call an action, unifying it with
|
36
|
+
# svn log representation.
|
37
|
+
action = entry.status
|
38
|
+
info "action: #{action}"
|
39
|
+
revisions = get_status_revisions entry
|
40
|
+
info "revisions: #{revisions}"
|
41
|
+
|
42
|
+
info "status.revision: #{entry.status_revision}"
|
43
|
+
|
44
|
+
@elements << Path.new(name, entry.status_revision, action, url)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# this may belong in Status::Entry
|
49
|
+
def get_status_revisions status_entry
|
50
|
+
# the printing revision in svn (svn diff -r20) are confusing, but this
|
51
|
+
# is what it looks like:
|
52
|
+
|
53
|
+
# when a file is added locally
|
54
|
+
# the revisions are (0, 0)
|
55
|
+
# when a file is modified:
|
56
|
+
# if the file is modified in other revisions since givenfromrev
|
57
|
+
# the revision is (most recent rev, working copy)
|
58
|
+
# otherwise
|
59
|
+
# the revision is (previous revision, working copy)
|
60
|
+
# when a file is deleted:
|
61
|
+
# the revision is (given from rev, working copy)
|
62
|
+
|
63
|
+
# okay, summary #2:
|
64
|
+
|
65
|
+
# if a file is modified,
|
66
|
+
# if the file existed at fromrev
|
67
|
+
# it is compared with fromrev
|
68
|
+
# else
|
69
|
+
# it is compared to BASE
|
70
|
+
|
71
|
+
info "status_entry.status: #{status_entry.status}"
|
72
|
+
|
73
|
+
action = SVNx::Action.new status_entry.status
|
74
|
+
case
|
75
|
+
when action.added?
|
76
|
+
info "added"
|
77
|
+
[ 0, 0 ]
|
78
|
+
when action.deleted?
|
79
|
+
info "deleted"
|
80
|
+
[ @revision.from, :working_copy ]
|
81
|
+
when action.modified?
|
82
|
+
info "modified"
|
83
|
+
[ status_entry.status_revision, :working_copy ]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/lib/pvn/io/element.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
require 'rubygems'
|
5
5
|
require 'riel'
|
6
|
-
require 'pvn/base/util'
|
7
6
|
|
8
7
|
require 'svnx/log/command'
|
9
8
|
require 'svnx/log/entries'
|
@@ -124,9 +123,22 @@ module PVN::IO
|
|
124
123
|
modified
|
125
124
|
end
|
126
125
|
|
127
|
-
def
|
128
|
-
|
129
|
-
|
126
|
+
def xxxcat_remote rev = nil
|
127
|
+
path = @local || @svn
|
128
|
+
info "path: #{path}".blue
|
129
|
+
info "rev: #{rev}; #{rev.class}".blue
|
130
|
+
catargs = SVNx::CatCommandArgs.new :path => path, :use_cache => false, :revision => rev
|
131
|
+
cmd = SVNx::CatCommand.new catargs
|
132
|
+
cmd.execute
|
133
|
+
end
|
134
|
+
|
135
|
+
def cat revision, use_cache = false
|
136
|
+
path = (@local || @path || @svn).dup
|
137
|
+
if revision && revision != :working_copy
|
138
|
+
path << '@' << revision.to_s
|
139
|
+
end
|
140
|
+
info "path: #{path}"
|
141
|
+
catargs = SVNx::CatCommandArgs.new :path => path, :use_cache => use_cache
|
130
142
|
cmd = SVNx::CatCommand.new catargs
|
131
143
|
cmd.execute
|
132
144
|
end
|
@@ -139,8 +151,8 @@ module PVN::IO
|
|
139
151
|
def find_files_by_status status = nil
|
140
152
|
cmdargs = SVNx::StatusCommandArgs.new :path => @local, :use_cache => false
|
141
153
|
cmd = SVNx::StatusCommand.new cmdargs
|
142
|
-
|
143
|
-
entries = SVNx::Status::Entries.new :xmllines =>
|
154
|
+
xmllines = cmd.execute
|
155
|
+
entries = SVNx::Status::Entries.new :xmllines => xmllines
|
144
156
|
|
145
157
|
if status
|
146
158
|
entries.select do |entry|
|
@@ -164,12 +176,21 @@ module PVN::IO
|
|
164
176
|
SVNx::Log::Entries.new :xmllines => cmd.execute
|
165
177
|
end
|
166
178
|
|
179
|
+
# returns log entries
|
180
|
+
def logentries revision
|
181
|
+
# use_cache should be conditional on revision:
|
182
|
+
# cmdargs[:use_cache] = false
|
183
|
+
cmdargs = SVNx::LogCommandArgs.new :path => @local, :revision => revision.to_s, :use_cache => false, :verbose => true
|
184
|
+
cmd = SVNx::LogCommand.new cmdargs
|
185
|
+
SVNx::Log::Entries.new :xmllines => cmd.execute
|
186
|
+
end
|
187
|
+
|
167
188
|
# returns :added, :deleted, "modified"
|
168
189
|
def status
|
169
190
|
cmdargs = SVNx::StatusCommandArgs.new :path => @local
|
170
191
|
cmd = SVNx::StatusCommand.new :cmdargs => cmdargs
|
171
|
-
|
172
|
-
entries = SVNx::Status::Entries.new :
|
192
|
+
xmllines = cmd.execute
|
193
|
+
entries = SVNx::Status::Entries.new :xmllines => xmllines
|
173
194
|
entry = entries[0]
|
174
195
|
entry.status
|
175
196
|
end
|
@@ -3,11 +3,11 @@
|
|
3
3
|
|
4
4
|
require 'pvn/io/element'
|
5
5
|
require 'pvn/log/formatter/entries_formatter'
|
6
|
-
require 'pvn/
|
7
|
-
require 'pvn/
|
6
|
+
require 'pvn/log/options'
|
7
|
+
require 'pvn/command/command'
|
8
8
|
|
9
|
-
module PVN::
|
10
|
-
class Command < PVN::
|
9
|
+
module PVN::Log
|
10
|
+
class Command < PVN::Command::Command
|
11
11
|
|
12
12
|
DEFAULT_LIMIT = 15
|
13
13
|
|
@@ -5,11 +5,11 @@ require 'synoption/set'
|
|
5
5
|
require 'synoption/option'
|
6
6
|
require 'synoption/fixnum_option'
|
7
7
|
require 'synoption/boolean_option'
|
8
|
-
require 'pvn/
|
9
|
-
require 'pvn/
|
10
|
-
require 'pvn/
|
8
|
+
require 'pvn/revision/multiple_revisions_option'
|
9
|
+
require 'pvn/command/options'
|
10
|
+
require 'pvn/command/color_option'
|
11
11
|
|
12
|
-
module PVN::
|
12
|
+
module PVN::Log
|
13
13
|
DEFAULT_LIMIT = 5
|
14
14
|
|
15
15
|
class LimitOption < PVN::FixnumOption
|
@@ -30,10 +30,10 @@ module PVN::Subcommands::Log
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
class OptionSet < PVN::
|
33
|
+
class OptionSet < PVN::Command::OptionSet
|
34
34
|
has_option :revision, PVN::MultipleRevisionsRegexpOption, [ :unsets => :limit ]
|
35
|
-
has_option :color, PVN::
|
36
|
-
has_option :help, PVN::
|
35
|
+
has_option :color, PVN::Command::ColorOption
|
36
|
+
has_option :help, PVN::Command::HelpOption
|
37
37
|
has_option :limit, LimitOption
|
38
38
|
has_option :user, UserOption
|
39
39
|
has_option :verbose, PVN::BooleanOption, [ :verbose, '-v', [ "include the files in the change" ], false ]
|
@@ -1,13 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require 'pvn/
|
5
|
-
require 'pvn/
|
6
|
-
require 'pvn/
|
7
|
-
require 'pvn/
|
4
|
+
require 'pvn/pct/options'
|
5
|
+
require 'pvn/command/command'
|
6
|
+
require 'pvn/pct/local_differ'
|
7
|
+
require 'pvn/pct/repository_differ'
|
8
8
|
|
9
|
-
module PVN::
|
10
|
-
class Command < PVN::
|
9
|
+
module PVN::Pct
|
10
|
+
class Command < PVN::Command::Command
|
11
11
|
|
12
12
|
subcommands [ "pct" ]
|
13
13
|
description "Compares revisions as a percentage of lines modified."
|
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
require 'pvn/io/element'
|
5
5
|
require 'svnx/cat/command'
|
6
|
-
require 'pvn/
|
7
|
-
require 'pvn/
|
6
|
+
require 'pvn/pct/diffcount'
|
7
|
+
require 'pvn/pct/differ'
|
8
8
|
|
9
|
-
module PVN::
|
9
|
+
module PVN::Pct
|
10
10
|
class LocalDiffer < Differ
|
11
11
|
def get_diff_counts path, options
|
12
12
|
elmt = PVN::IO::Element.new :local => path
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'pvn/revision/multiple_revisions_option'
|
5
|
+
require 'pvn/command/options'
|
6
|
+
|
7
|
+
module PVN::Pct
|
8
|
+
class OptionSet < PVN::Command::OptionSet
|
9
|
+
has_option :revision, PVN::MultipleRevisionsRegexpOption
|
10
|
+
has_option :help, PVN::Command::HelpOption
|
11
|
+
end
|
12
|
+
end
|
@@ -2,11 +2,10 @@
|
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
4
|
require 'pvn/io/element'
|
5
|
-
require '
|
6
|
-
require 'pvn/
|
7
|
-
require 'pvn/subcommands/pct/differ'
|
5
|
+
require 'pvn/pct/diffcount'
|
6
|
+
require 'pvn/pct/differ'
|
8
7
|
|
9
|
-
module PVN::
|
8
|
+
module PVN::Pct
|
10
9
|
class RepositoryDiffer < Differ
|
11
10
|
### $$$ this belongs in Revision
|
12
11
|
def get_from_to_revisions rev
|
@@ -24,13 +23,6 @@ module PVN::Subcommands::Pct
|
|
24
23
|
info "rev: #{rev}".bold.white.on_red
|
25
24
|
end
|
26
25
|
end
|
27
|
-
|
28
|
-
def get_line_count path, revision
|
29
|
-
info "path: #{path}".yellow
|
30
|
-
cmdargs = SVNx::CatCommandArgs.new :path => path, :revision => revision
|
31
|
-
catcmd = SVNx::CatCommand.new cmdargs
|
32
|
-
catcmd.execute.size
|
33
|
-
end
|
34
26
|
|
35
27
|
def get_diff_counts path, options
|
36
28
|
diff_counts = Array.new
|
@@ -62,8 +54,8 @@ module PVN::Subcommands::Pct
|
|
62
54
|
next unless elmt.has_revision? torev
|
63
55
|
next if elmt.get_info.kind == 'dir'
|
64
56
|
|
65
|
-
from_count =
|
66
|
-
to_count =
|
57
|
+
from_count = elmt.cat(fromrev).size
|
58
|
+
to_count = elmt.cat(torev).size
|
67
59
|
|
68
60
|
name = mod.dup
|
69
61
|
name.slice! filterre
|
@@ -2,25 +2,29 @@
|
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
4
|
require 'svnx/log/entries'
|
5
|
+
require 'pvn/revision/error'
|
5
6
|
|
6
|
-
|
7
|
-
# replace lib/pvn/revision.rb as PVN::Revision.
|
7
|
+
module PVN; module Revision; end; end
|
8
8
|
|
9
|
+
# We represent what svn calls a revision (-r134:{2010-1-1}) as a Range,
|
10
|
+
# consisting of a from and to (optional) Argument.
|
9
11
|
module PVN::Revision
|
10
|
-
class RevisionError < RuntimeError
|
11
|
-
end
|
12
|
-
|
13
|
-
DATE_REGEXP = Regexp.new '^\{(.*?)\}'
|
14
|
-
SVN_REVISION_WORDS = %w{ HEAD BASE COMMITTED PREV }
|
15
12
|
RELATIVE_REVISION_RE = Regexp.new '^([\+\-])(\d+)$'
|
16
|
-
|
13
|
+
|
17
14
|
# Returns the Nth revision from the given logging output.
|
18
|
-
|
15
|
+
|
19
16
|
# -n means to count from the end of the list.
|
20
17
|
# +n means to count from the beginning of the list.
|
21
18
|
# n means the literal revision number.
|
22
|
-
class
|
23
|
-
include Loggable
|
19
|
+
class Argument
|
20
|
+
include Loggable, Comparable
|
21
|
+
|
22
|
+
DATE_REGEXP = Regexp.new '^\{(.*?)\}'
|
23
|
+
SVN_ARGUMENT_WORDS = %w{ HEAD BASE COMMITTED PREV }
|
24
|
+
|
25
|
+
# these are also valid revisions
|
26
|
+
# :working_copy
|
27
|
+
# :head
|
24
28
|
|
25
29
|
attr_reader :value
|
26
30
|
attr_reader :log_entry
|
@@ -28,37 +32,36 @@ module PVN::Revision
|
|
28
32
|
class << self
|
29
33
|
alias_method :orig_new, :new
|
30
34
|
|
31
|
-
def new
|
32
|
-
value = args[:value]
|
33
|
-
|
35
|
+
def new value, xmllines = nil
|
34
36
|
# these are lines from "svn log -v <file>"
|
35
|
-
xmllines = args[:xmllines]
|
36
37
|
if xmllines.kind_of? Array
|
37
38
|
xmllines = xmllines.join ''
|
38
39
|
end
|
39
|
-
|
40
|
+
|
40
41
|
case value
|
41
42
|
when Fixnum
|
42
43
|
if value < 0
|
43
|
-
|
44
|
+
RelativeArgument.orig_new value, xmllines
|
44
45
|
else
|
45
|
-
|
46
|
+
FixnumArgument.orig_new value
|
46
47
|
end
|
47
48
|
when String
|
48
|
-
if
|
49
|
-
|
49
|
+
if SVN_ARGUMENT_WORDS.include? value
|
50
|
+
StringArgument.orig_new value
|
50
51
|
elsif md = RELATIVE_REVISION_RE.match(value)
|
51
|
-
|
52
|
+
RelativeArgument.orig_new md[0].to_i, xmllines
|
52
53
|
elsif DATE_REGEXP.match value
|
53
|
-
|
54
|
+
StringArgument.orig_new value
|
54
55
|
else
|
55
|
-
|
56
|
+
FixnumArgument.orig_new value.to_i
|
56
57
|
end
|
58
|
+
when Symbol
|
59
|
+
raise RevisionError.new "symbol not yet handled"
|
57
60
|
when Date
|
58
61
|
# $$$ this (and Time) will probably have to be converted to svn's format
|
59
|
-
raise "date not yet handled"
|
62
|
+
raise RevisionError.new "date not yet handled"
|
60
63
|
when Time
|
61
|
-
raise "time not yet handled"
|
64
|
+
raise RevisionError.new "time not yet handled"
|
62
65
|
end
|
63
66
|
end
|
64
67
|
|
@@ -70,22 +73,34 @@ module PVN::Revision
|
|
70
73
|
def initialize value
|
71
74
|
@value = value
|
72
75
|
end
|
76
|
+
|
77
|
+
def to_s
|
78
|
+
@value.to_s
|
79
|
+
end
|
80
|
+
|
81
|
+
def <=> other
|
82
|
+
@value <=> other.value
|
83
|
+
end
|
73
84
|
end
|
74
85
|
|
75
|
-
class
|
86
|
+
class FixnumArgument < Argument
|
76
87
|
end
|
77
88
|
|
78
|
-
class
|
89
|
+
class StringArgument < Argument
|
79
90
|
end
|
80
91
|
|
81
|
-
class
|
92
|
+
class WorkingCopyArgument < Argument
|
93
|
+
end
|
94
|
+
|
95
|
+
# this is of the form -3, which is revision[-3] (second one from the most
|
96
|
+
# recent; -1 is the most recent).
|
97
|
+
class RelativeArgument < FixnumArgument
|
82
98
|
def initialize value, xmllines
|
83
99
|
unless xmllines
|
84
100
|
raise RevisionError.new "cannot determine relative revision without xmllines"
|
85
101
|
end
|
86
|
-
|
102
|
+
|
87
103
|
logentries = SVNx::Log::Entries.new :xmllines => xmllines
|
88
|
-
|
89
104
|
nentries = logentries.size
|
90
105
|
|
91
106
|
# logentries are in descending order, so the most recent one is index 0
|
@@ -5,7 +5,6 @@ require 'riel'
|
|
5
5
|
require 'rubygems'
|
6
6
|
require 'synoption/option'
|
7
7
|
require 'svnx/log/command'
|
8
|
-
require 'pvn/revision/entry'
|
9
8
|
|
10
9
|
module PVN
|
11
10
|
class BaseRevisionOption < Option
|
@@ -31,7 +30,8 @@ module PVN
|
|
31
30
|
limit = rel[0, 1] == '-' ? rel.to_i.abs : nil
|
32
31
|
xmllines = run_log_command limit, path
|
33
32
|
|
34
|
-
|
33
|
+
# This is Argument, not Range, because we're getting the value
|
34
|
+
reventry = PVN::Revision::Argument.new rel, xmllines
|
35
35
|
revval = reventry.value.to_s
|
36
36
|
revval
|
37
37
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'svnx/log/entries'
|
5
|
+
require 'pvn/revision/argument'
|
6
|
+
|
7
|
+
module PVN; module Revision; end; end
|
8
|
+
|
9
|
+
module PVN::Revision
|
10
|
+
# this is of the form: -r123:456
|
11
|
+
class Range
|
12
|
+
include Loggable
|
13
|
+
|
14
|
+
attr_reader :from
|
15
|
+
attr_reader :to
|
16
|
+
|
17
|
+
def initialize from, to = nil, xmllines = nil
|
18
|
+
if to
|
19
|
+
@from = to_revision from, xmllines
|
20
|
+
@to = to_revision to, xmllines
|
21
|
+
elsif from.kind_of? String
|
22
|
+
@from, @to = from.split(':').collect { |x| to_revision x, xmllines }
|
23
|
+
else
|
24
|
+
@from = to_revision from, xmllines
|
25
|
+
@to = :working_copy
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_revision val, xmllines
|
30
|
+
val.kind_of?(Argument) || Argument.new(val, xmllines)
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
str = @from.to_s
|
35
|
+
unless working_copy?
|
36
|
+
str << ':' << @to.to_s
|
37
|
+
end
|
38
|
+
str
|
39
|
+
end
|
40
|
+
|
41
|
+
def head?
|
42
|
+
@to == :head
|
43
|
+
end
|
44
|
+
|
45
|
+
def working_copy?
|
46
|
+
@to == nil || @to == :wc || @to == :working_copy
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -1,20 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require 'pvn/
|
4
|
+
require 'pvn/revision/base_option'
|
5
5
|
|
6
6
|
module PVN
|
7
7
|
class RevisionOption < BaseRevisionOption
|
8
8
|
attr_accessor :fromdate
|
9
9
|
attr_accessor :todate
|
10
10
|
|
11
|
-
REVISION_DESCRIPTION = [ "revision to apply.",
|
12
|
-
"ARG can be relative, of the form:",
|
13
|
-
" +N : N revisions from the BASE",
|
14
|
-
" -N : N revisions from the HEAD,",
|
15
|
-
" when -1 is the previous revision" ,
|
16
|
-
]
|
17
|
-
|
18
11
|
def initialize revargs = Hash.new
|
19
12
|
@fromdate = nil
|
20
13
|
@todate = nil
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require 'pvn/
|
4
|
+
require 'pvn/revision/revision_option'
|
5
5
|
|
6
6
|
module PVN
|
7
7
|
# A revision that is also set by -N and +N.
|
@@ -19,7 +19,7 @@ module PVN
|
|
19
19
|
revargs[:regexp] = TAG_RE
|
20
20
|
super
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def resolve_value optset, unprocessed
|
24
24
|
val = value
|
25
25
|
md = TAG_RE.match val
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
4
|
require 'pvn/io/element'
|
5
|
-
require 'pvn/
|
6
|
-
require 'pvn/
|
5
|
+
require 'pvn/command/command'
|
6
|
+
require 'pvn/status/options'
|
7
7
|
require 'pvn/status/formatter/entries_formatter'
|
8
8
|
|
9
|
-
module PVN::
|
10
|
-
class Command < PVN::
|
9
|
+
module PVN::Status
|
10
|
+
class Command < PVN::Command::Command
|
11
11
|
|
12
12
|
DEFAULT_LIMIT = 15
|
13
13
|
|
14
|
-
subcommands [ "status" ]
|
14
|
+
subcommands [ "status", "st" ]
|
15
15
|
description "Prints the status for locally changed files."
|
16
16
|
usage "[OPTIONS] FILE..."
|
17
17
|
summary [ "Prints the status for the given files, with colorized",
|
@@ -41,7 +41,7 @@ module PVN::Subcommands::Status
|
|
41
41
|
end
|
42
42
|
|
43
43
|
fmtr = PVN::Status::EntriesFormatter.new options.color, allentries
|
44
|
-
puts fmtr.format
|
44
|
+
$io.puts fmtr.format
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'pvn/command/options'
|
5
|
+
require 'pvn/command/color_option'
|
6
|
+
|
7
|
+
module PVN::Status
|
8
|
+
class OptionSet < PVN::Command::OptionSet
|
9
|
+
has_option :color, PVN::Command::ColorOption
|
10
|
+
has_option :help, PVN::Command::HelpOption
|
11
|
+
end
|
12
|
+
end
|