subversion 1.6.6-x86-mswin32-60 → 1.6.11-x86-mswin32-60
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/licenses/apr-util/NOTICE +1 -1
- data/licenses/apr/NOTICE +1 -1
- data/licenses/zlib/README +37 -48
- data/readme.txt +20 -0
- data/{ruby → subversion}/ext/svn/ext/client.dll +0 -0
- data/subversion/ext/svn/ext/core.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/delta.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/fs.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/intl3_svn.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libapr-1.dll +0 -0
- data/subversion/ext/svn/ext/libaprutil-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libdb44.dll +0 -0
- data/subversion/ext/svn/ext/libsasl.dll +0 -0
- data/subversion/ext/svn/ext/libsvn_client-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_delta-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_diff-1.dll +0 -0
- data/subversion/ext/svn/ext/libsvn_fs-1.dll +0 -0
- data/subversion/ext/svn/ext/libsvn_ra-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_repos-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_subr-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/libsvn_swig_ruby-1.dll +0 -0
- data/subversion/ext/svn/ext/libsvn_wc-1.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/ra.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/repos.dll +0 -0
- data/{ruby → subversion}/ext/svn/ext/wc.dll +0 -0
- data/{ruby → subversion}/lib/svn/client.rb +0 -0
- data/{ruby → subversion}/lib/svn/core.rb +0 -0
- data/{ruby → subversion}/lib/svn/delta.rb +2 -2
- data/{ruby → subversion}/lib/svn/error.rb +0 -0
- data/{ruby → subversion}/lib/svn/fs.rb +0 -0
- data/{ruby → subversion}/lib/svn/info.rb +0 -0
- data/{ruby → subversion}/lib/svn/ra.rb +0 -0
- data/{ruby → subversion}/lib/svn/repos.rb +0 -0
- data/{ruby → subversion}/lib/svn/util.rb +0 -0
- data/{ruby → subversion}/lib/svn/wc.rb +0 -0
- data/subversion/test/greek_tree.rb +63 -0
- data/subversion/test/my-assertions.rb +48 -0
- data/subversion/test/run-test.rb +35 -0
- data/subversion/test/test-unit-ext.rb +4 -0
- data/subversion/test/test-unit-ext/always-show-result.rb +28 -0
- data/subversion/test/test-unit-ext/backtrace-filter.rb +17 -0
- data/subversion/test/test-unit-ext/long-display-for-emacs.rb +25 -0
- data/subversion/test/test-unit-ext/priority.rb +176 -0
- data/subversion/test/test_client.rb +2457 -0
- data/subversion/test/test_core.rb +849 -0
- data/subversion/test/test_delta.rb +497 -0
- data/subversion/test/test_error.rb +16 -0
- data/subversion/test/test_fs.rb +519 -0
- data/subversion/test/test_info.rb +331 -0
- data/subversion/test/test_ra.rb +436 -0
- data/subversion/test/test_repos.rb +872 -0
- data/subversion/test/test_util.rb +18 -0
- data/subversion/test/test_wc.rb +1063 -0
- data/subversion/test/util.rb +292 -0
- data/subversion/test/windows_util.rb +263 -0
- metadata +71 -39
- data/ruby/ext/svn/ext/core.dll +0 -0
- data/ruby/ext/svn/ext/libaprutil-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_client-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_fs-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_ra-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_wc-1.dll +0 -0
@@ -0,0 +1,497 @@
|
|
1
|
+
require "util"
|
2
|
+
require "stringio"
|
3
|
+
require 'md5'
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
require "svn/info"
|
7
|
+
|
8
|
+
class SvnDeltaTest < Test::Unit::TestCase
|
9
|
+
include SvnTestUtil
|
10
|
+
|
11
|
+
def setup
|
12
|
+
setup_basic
|
13
|
+
end
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
teardown_basic
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_version
|
20
|
+
assert_equal(Svn::Core.subr_version, Svn::Delta.version)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_txdelta_window
|
24
|
+
s = ("a\nb\nc\nd\ne" + "\n" * 100) * 1000
|
25
|
+
t = ("a\nb\nX\nd\ne" + "\n" * 100) * 1000
|
26
|
+
source = StringIO.new(s)
|
27
|
+
target = StringIO.new(t)
|
28
|
+
stream = Svn::Delta::TextDeltaStream.new(source, target)
|
29
|
+
assert_nil(stream.md5_digest)
|
30
|
+
_wrap_assertion do
|
31
|
+
stream.each do |window|
|
32
|
+
window.ops.each do |op|
|
33
|
+
op_size = op.offset + op.length
|
34
|
+
case op.action_code
|
35
|
+
when Svn::Delta::TXDELTA_SOURCE
|
36
|
+
assert_operator(op_size, :<=, window.sview_len)
|
37
|
+
when Svn::Delta::TXDELTA_NEW
|
38
|
+
assert_operator(op_size, :<=, window.new_data.length)
|
39
|
+
when Svn::Delta::TXDELTA_TARGET
|
40
|
+
assert_operator(op_size, :<=, window.tview_len)
|
41
|
+
else
|
42
|
+
flunk
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
assert_equal(MD5.new(t).hexdigest, stream.md5_digest)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_txdelta_window_compose
|
51
|
+
s = ("a\nb\nc\nd\ne" + "\n" * 100) * 1000
|
52
|
+
t = ("a\nb\nX\nd\ne" + "\n" * 100) * 1000
|
53
|
+
source = StringIO.new(s)
|
54
|
+
target = StringIO.new(t)
|
55
|
+
stream = Svn::Delta::TextDeltaStream.new(source, target)
|
56
|
+
composed_window = nil
|
57
|
+
stream.each do |window|
|
58
|
+
if composed_window.nil?
|
59
|
+
composed_window = window
|
60
|
+
else
|
61
|
+
composed_window = composed_window.compose(window)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
_wrap_assertion do
|
66
|
+
composed_window.ops.each do |op|
|
67
|
+
op_size = op.offset + op.length
|
68
|
+
case op.action_code
|
69
|
+
when Svn::Delta::TXDELTA_SOURCE
|
70
|
+
assert_operator(op_size, :<=, composed_window.sview_len)
|
71
|
+
when Svn::Delta::TXDELTA_NEW
|
72
|
+
assert_operator(op_size, :<=, composed_window.new_data.length)
|
73
|
+
when Svn::Delta::TXDELTA_TARGET
|
74
|
+
assert_operator(op_size, :<=, composed_window.tview_len)
|
75
|
+
else
|
76
|
+
flunk
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_txdelta_apply_instructions
|
83
|
+
s = ("a\nb\nc\nd\ne" + "\n" * 100) * 1000
|
84
|
+
t = ("a\nb\nX\nd\ne" + "\n" * 100) * 1000
|
85
|
+
source = StringIO.new(s)
|
86
|
+
target = StringIO.new(t)
|
87
|
+
stream = Svn::Delta::TextDeltaStream.new(source, target)
|
88
|
+
|
89
|
+
result = ""
|
90
|
+
offset = 0
|
91
|
+
stream.each do |window|
|
92
|
+
result << window.apply_instructions(s[offset, window.sview_len])
|
93
|
+
offset += window.sview_len
|
94
|
+
end
|
95
|
+
assert_equal(t, result)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_push_target
|
99
|
+
source = StringIO.new("abcde")
|
100
|
+
target_content = "ZZZ" * 100
|
101
|
+
data = ""
|
102
|
+
finished = false
|
103
|
+
handler = Proc.new do |window|
|
104
|
+
if window
|
105
|
+
data << window.new_data
|
106
|
+
else
|
107
|
+
finished = true
|
108
|
+
end
|
109
|
+
end
|
110
|
+
target = Svn::Delta::TextDeltaStream.push_target(source, &handler)
|
111
|
+
target.write(target_content)
|
112
|
+
assert(!finished)
|
113
|
+
target.close
|
114
|
+
assert(finished)
|
115
|
+
assert_equal(target_content, data)
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_apply
|
119
|
+
source_text = "abcde"
|
120
|
+
target_text = "abXde"
|
121
|
+
source = StringIO.new(source_text)
|
122
|
+
target = StringIO.new(target_text)
|
123
|
+
stream = Svn::Delta::TextDeltaStream.new(source, target)
|
124
|
+
|
125
|
+
apply_source = StringIO.new(source_text)
|
126
|
+
apply_result = StringIO.new("")
|
127
|
+
|
128
|
+
handler, digest = Svn::Delta.apply(apply_source, apply_result)
|
129
|
+
assert_nil(digest)
|
130
|
+
handler.send(stream)
|
131
|
+
apply_result.rewind
|
132
|
+
assert_equal(target_text, apply_result.read)
|
133
|
+
|
134
|
+
handler, digest = Svn::Delta.apply(apply_source, apply_result)
|
135
|
+
handler.send(target_text)
|
136
|
+
apply_result.rewind
|
137
|
+
assert_equal(target_text * 2, apply_result.read)
|
138
|
+
|
139
|
+
handler, digest = Svn::Delta.apply(apply_source, apply_result)
|
140
|
+
handler.send(StringIO.new(target_text))
|
141
|
+
apply_result.rewind
|
142
|
+
assert_equal(target_text * 3, apply_result.read)
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_svndiff
|
146
|
+
source_text = "abcde"
|
147
|
+
target_text = "abXde"
|
148
|
+
source = StringIO.new(source_text)
|
149
|
+
target = StringIO.new(target_text)
|
150
|
+
stream = Svn::Delta::TextDeltaStream.new(source, target)
|
151
|
+
|
152
|
+
output = StringIO.new("")
|
153
|
+
handler = Svn::Delta.svndiff_handler(output)
|
154
|
+
|
155
|
+
Svn::Delta.send(target_text, handler)
|
156
|
+
output.rewind
|
157
|
+
result = output.read
|
158
|
+
assert_match(/\ASVN.*#{target_text}\z/, result)
|
159
|
+
|
160
|
+
# skip svndiff window
|
161
|
+
input = StringIO.new(result[4..-1])
|
162
|
+
window = Svn::Delta.read_svndiff_window(input, 0)
|
163
|
+
assert_equal(target_text, window.new_data)
|
164
|
+
|
165
|
+
finished = false
|
166
|
+
data = ""
|
167
|
+
stream = Svn::Delta.parse_svndiff do |window|
|
168
|
+
if window
|
169
|
+
data << window.new_data
|
170
|
+
else
|
171
|
+
finished = true
|
172
|
+
end
|
173
|
+
end
|
174
|
+
stream.write(result)
|
175
|
+
stream.close
|
176
|
+
assert(finished)
|
177
|
+
assert_equal(target_text, data)
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_path_driver
|
181
|
+
editor = Svn::Delta::BaseEditor.new
|
182
|
+
sorted_paths = []
|
183
|
+
callback = Proc.new do |parent_baton, path|
|
184
|
+
sorted_paths << path
|
185
|
+
end
|
186
|
+
|
187
|
+
targets = [
|
188
|
+
"/",
|
189
|
+
"/file1",
|
190
|
+
"/dir1",
|
191
|
+
"/dir2/file2",
|
192
|
+
"/dir2/dir3/file3",
|
193
|
+
"/dir2/dir3/file4"
|
194
|
+
]
|
195
|
+
10.times do
|
196
|
+
x = rand(targets.size)
|
197
|
+
y = rand(targets.size)
|
198
|
+
targets[x], targets[y] = targets[y], targets[x]
|
199
|
+
end
|
200
|
+
Svn::Delta.path_driver(editor, 0, targets, &callback)
|
201
|
+
assert_equal(targets.sort, sorted_paths)
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_changed
|
205
|
+
dir = "changed_dir"
|
206
|
+
dir1 = "changed_dir1"
|
207
|
+
dir2 = "changed_dir2"
|
208
|
+
dir_path = File.join(@wc_path, dir)
|
209
|
+
dir1_path = File.join(@wc_path, dir1)
|
210
|
+
dir2_path = File.join(@wc_path, dir2)
|
211
|
+
dir_svn_path = dir
|
212
|
+
dir1_svn_path = dir1
|
213
|
+
dir2_svn_path = dir2
|
214
|
+
|
215
|
+
file1 = "changed1.txt"
|
216
|
+
file2 = "changed2.txt"
|
217
|
+
file3 = "changed3.txt"
|
218
|
+
file4 = "changed4.txt"
|
219
|
+
file5 = "changed5.txt"
|
220
|
+
file1_path = File.join(@wc_path, file1)
|
221
|
+
file2_path = File.join(dir_path, file2)
|
222
|
+
file3_path = File.join(@wc_path, file3)
|
223
|
+
file4_path = File.join(dir_path, file4)
|
224
|
+
file5_path = File.join(@wc_path, file5)
|
225
|
+
file1_svn_path = file1
|
226
|
+
file2_svn_path = [dir_svn_path, file2].join("/")
|
227
|
+
file3_svn_path = file3
|
228
|
+
file4_svn_path = [dir_svn_path, file4].join("/")
|
229
|
+
file5_svn_path = file5
|
230
|
+
|
231
|
+
first_rev = nil
|
232
|
+
|
233
|
+
log = "added 3 dirs\nanded 5 files"
|
234
|
+
make_context(log) do |ctx|
|
235
|
+
|
236
|
+
ctx.mkdir([dir_path, dir1_path, dir2_path])
|
237
|
+
|
238
|
+
FileUtils.touch(file1_path)
|
239
|
+
FileUtils.touch(file2_path)
|
240
|
+
FileUtils.touch(file3_path)
|
241
|
+
FileUtils.touch(file4_path)
|
242
|
+
FileUtils.touch(file5_path)
|
243
|
+
ctx.add(file1_path)
|
244
|
+
ctx.add(file2_path)
|
245
|
+
ctx.add(file3_path)
|
246
|
+
ctx.add(file4_path)
|
247
|
+
ctx.add(file5_path)
|
248
|
+
|
249
|
+
commit_info = ctx.commit(@wc_path)
|
250
|
+
first_rev = commit_info.revision
|
251
|
+
|
252
|
+
editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)
|
253
|
+
assert_equal([
|
254
|
+
file1_svn_path, file2_svn_path,
|
255
|
+
file3_svn_path, file4_svn_path,
|
256
|
+
file5_svn_path,
|
257
|
+
].sort,
|
258
|
+
editor.added_files)
|
259
|
+
assert_equal([], editor.updated_files)
|
260
|
+
assert_equal([], editor.deleted_files)
|
261
|
+
assert_equal([].sort, editor.updated_dirs)
|
262
|
+
assert_equal([].sort, editor.deleted_dirs)
|
263
|
+
assert_equal([
|
264
|
+
"#{dir_svn_path}/",
|
265
|
+
"#{dir1_svn_path}/",
|
266
|
+
"#{dir2_svn_path}/"
|
267
|
+
].sort,
|
268
|
+
editor.added_dirs)
|
269
|
+
end
|
270
|
+
|
271
|
+
log = "deleted 2 dirs\nchanged 3 files\ndeleted 2 files\nadded 3 files"
|
272
|
+
make_context(log) do |ctx|
|
273
|
+
|
274
|
+
dir3 = "changed_dir3"
|
275
|
+
dir4 = "changed_dir4"
|
276
|
+
dir3_path = File.join(dir_path, dir3)
|
277
|
+
dir4_path = File.join(@wc_path, dir4)
|
278
|
+
dir3_svn_path = [dir_svn_path, dir3].join("/")
|
279
|
+
dir4_svn_path = dir4
|
280
|
+
|
281
|
+
file6 = "changed6.txt"
|
282
|
+
file7 = "changed7.txt"
|
283
|
+
file8 = "changed8.txt"
|
284
|
+
file9 = "changed9.txt"
|
285
|
+
file10 = "changed10.txt"
|
286
|
+
file6_path = File.join(dir_path, file6)
|
287
|
+
file7_path = File.join(@wc_path, file7)
|
288
|
+
file8_path = File.join(dir_path, file8)
|
289
|
+
file9_path = File.join(dir_path, file9)
|
290
|
+
file10_path = File.join(dir_path, file10)
|
291
|
+
file6_svn_path = [dir_svn_path, file6].join("/")
|
292
|
+
file7_svn_path = file7
|
293
|
+
file8_svn_path = [dir_svn_path, file8].join("/")
|
294
|
+
file9_svn_path = [dir_svn_path, file9].join("/")
|
295
|
+
file10_svn_path = [dir_svn_path, file10].join("/")
|
296
|
+
|
297
|
+
File.open(file1_path, "w") {|f| f.puts "changed"}
|
298
|
+
File.open(file2_path, "w") {|f| f.puts "changed"}
|
299
|
+
File.open(file3_path, "w") {|f| f.puts "changed"}
|
300
|
+
ctx.rm_f([file4_path, file5_path])
|
301
|
+
FileUtils.touch(file6_path)
|
302
|
+
FileUtils.touch(file7_path)
|
303
|
+
FileUtils.touch(file8_path)
|
304
|
+
ctx.add(file6_path)
|
305
|
+
ctx.add(file7_path)
|
306
|
+
ctx.add(file8_path)
|
307
|
+
ctx.cp(file1_path, file9_path)
|
308
|
+
ctx.cp(file2_path, file10_path)
|
309
|
+
ctx.mv(dir2_path, dir3_path)
|
310
|
+
ctx.cp(dir1_path, dir4_path)
|
311
|
+
ctx.rm(dir1_path)
|
312
|
+
|
313
|
+
commit_info = ctx.commit(@wc_path)
|
314
|
+
second_rev = commit_info.revision
|
315
|
+
|
316
|
+
editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)
|
317
|
+
assert_equal([file1_svn_path, file2_svn_path, file3_svn_path].sort,
|
318
|
+
editor.updated_files)
|
319
|
+
assert_equal([file4_svn_path, file5_svn_path].sort,
|
320
|
+
editor.deleted_files)
|
321
|
+
assert_equal([file6_svn_path, file7_svn_path, file8_svn_path].sort,
|
322
|
+
editor.added_files)
|
323
|
+
assert_equal([].sort, editor.updated_dirs)
|
324
|
+
assert_equal([
|
325
|
+
[file9_svn_path, file1_svn_path, first_rev],
|
326
|
+
[file10_svn_path, file2_svn_path, first_rev],
|
327
|
+
].sort_by{|x| x[0]},
|
328
|
+
editor.copied_files)
|
329
|
+
assert_equal([
|
330
|
+
["#{dir3_svn_path}/", "#{dir2_svn_path}/", first_rev],
|
331
|
+
["#{dir4_svn_path}/", "#{dir1_svn_path}/", first_rev],
|
332
|
+
].sort_by{|x| x[0]},
|
333
|
+
editor.copied_dirs)
|
334
|
+
assert_equal(["#{dir1_svn_path}/", "#{dir2_svn_path}/"].sort,
|
335
|
+
editor.deleted_dirs)
|
336
|
+
assert_equal([].sort, editor.added_dirs)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_change_prop
|
341
|
+
prop_name = "prop"
|
342
|
+
prop_value = "value"
|
343
|
+
|
344
|
+
dir = "dir"
|
345
|
+
dir_path = File.join(@wc_path, dir)
|
346
|
+
dir_svn_path = dir
|
347
|
+
|
348
|
+
file1 = "file1.txt"
|
349
|
+
file2 = "file2.txt"
|
350
|
+
file1_path = File.join(@wc_path, file1)
|
351
|
+
file2_path = File.join(dir_path, file2)
|
352
|
+
|
353
|
+
log = "added 1 dirs\nanded 2 files"
|
354
|
+
make_context(log) do |ctx|
|
355
|
+
|
356
|
+
ctx.mkdir([dir_path])
|
357
|
+
|
358
|
+
file1_svn_path = file1
|
359
|
+
file2_svn_path = [dir_svn_path, file2].join("/")
|
360
|
+
FileUtils.touch(file1_path)
|
361
|
+
FileUtils.touch(file2_path)
|
362
|
+
ctx.add(file1_path)
|
363
|
+
ctx.add(file2_path)
|
364
|
+
|
365
|
+
ctx.propset(prop_name, prop_value, dir_path)
|
366
|
+
|
367
|
+
commit_info = ctx.commit(@wc_path)
|
368
|
+
|
369
|
+
editor = traverse(Svn::Delta::ChangedDirsEditor, commit_info.revision)
|
370
|
+
assert_equal(["", dir_svn_path].collect{|path| "#{path}/"}.sort,
|
371
|
+
editor.changed_dirs)
|
372
|
+
end
|
373
|
+
|
374
|
+
log = "prop changed"
|
375
|
+
make_context(log) do |ctx|
|
376
|
+
|
377
|
+
ctx.propdel(prop_name, dir_path)
|
378
|
+
|
379
|
+
commit_info = ctx.commit(@wc_path)
|
380
|
+
|
381
|
+
editor = traverse(Svn::Delta::ChangedDirsEditor, commit_info.revision)
|
382
|
+
assert_equal([dir_svn_path].collect{|path| "#{path}/"}.sort,
|
383
|
+
editor.changed_dirs)
|
384
|
+
|
385
|
+
|
386
|
+
ctx.propset(prop_name, prop_value, file1_path)
|
387
|
+
|
388
|
+
commit_info = ctx.commit(@wc_path)
|
389
|
+
|
390
|
+
editor = traverse(Svn::Delta::ChangedDirsEditor, commit_info.revision)
|
391
|
+
assert_equal([""].collect{|path| "#{path}/"}.sort,
|
392
|
+
editor.changed_dirs)
|
393
|
+
|
394
|
+
|
395
|
+
ctx.propdel(prop_name, file1_path)
|
396
|
+
ctx.propset(prop_name, prop_value, file2_path)
|
397
|
+
|
398
|
+
commit_info = ctx.commit(@wc_path)
|
399
|
+
|
400
|
+
editor = traverse(Svn::Delta::ChangedDirsEditor, commit_info.revision)
|
401
|
+
assert_equal(["", dir_svn_path].collect{|path| "#{path}/"}.sort,
|
402
|
+
editor.changed_dirs)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
def test_deep_copy
|
407
|
+
dir1 = "dir1"
|
408
|
+
dir2 = "dir2"
|
409
|
+
dir1_path = File.join(@wc_path, dir1)
|
410
|
+
dir2_path = File.join(dir1_path, dir2)
|
411
|
+
dir1_svn_path = dir1
|
412
|
+
dir2_svn_path = [dir1, dir2].join("/")
|
413
|
+
|
414
|
+
first_rev = nil
|
415
|
+
|
416
|
+
log = "added 2 dirs\nanded 3 files"
|
417
|
+
make_context(log) do |ctx|
|
418
|
+
|
419
|
+
ctx.mkdir([dir1_path, dir2_path])
|
420
|
+
|
421
|
+
file1 = "file1.txt"
|
422
|
+
file2 = "file2.txt"
|
423
|
+
file3 = "file3.txt"
|
424
|
+
file1_path = File.join(@wc_path, file1)
|
425
|
+
file2_path = File.join(dir1_path, file2)
|
426
|
+
file3_path = File.join(dir2_path, file3)
|
427
|
+
file1_svn_path = file1
|
428
|
+
file2_svn_path = [dir1_svn_path, file2].join("/")
|
429
|
+
file3_svn_path = [dir2_svn_path, file3].join("/")
|
430
|
+
FileUtils.touch(file1_path)
|
431
|
+
FileUtils.touch(file2_path)
|
432
|
+
FileUtils.touch(file3_path)
|
433
|
+
ctx.add(file1_path)
|
434
|
+
ctx.add(file2_path)
|
435
|
+
ctx.add(file3_path)
|
436
|
+
|
437
|
+
commit_info = ctx.commit(@wc_path)
|
438
|
+
first_rev = commit_info.revision
|
439
|
+
|
440
|
+
editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)
|
441
|
+
assert_equal([
|
442
|
+
file1_svn_path, file2_svn_path,
|
443
|
+
file3_svn_path,
|
444
|
+
].sort,
|
445
|
+
editor.added_files)
|
446
|
+
assert_equal([].sort, editor.updated_files)
|
447
|
+
assert_equal([].sort, editor.deleted_files)
|
448
|
+
assert_equal([].sort, editor.updated_dirs)
|
449
|
+
assert_equal([].sort, editor.deleted_dirs)
|
450
|
+
assert_equal([
|
451
|
+
"#{dir1_svn_path}/",
|
452
|
+
"#{dir2_svn_path}/",
|
453
|
+
].sort,
|
454
|
+
editor.added_dirs)
|
455
|
+
end
|
456
|
+
|
457
|
+
log = "copied top dir"
|
458
|
+
make_context(log) do |ctx|
|
459
|
+
|
460
|
+
dir3 = "dir3"
|
461
|
+
dir3_path = File.join(@wc_path, dir3)
|
462
|
+
dir3_svn_path = dir3
|
463
|
+
|
464
|
+
ctx.cp(dir1_path, dir3_path)
|
465
|
+
|
466
|
+
commit_info = ctx.commit(@wc_path)
|
467
|
+
second_rev = commit_info.revision
|
468
|
+
|
469
|
+
editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)
|
470
|
+
assert_equal([].sort, editor.updated_files)
|
471
|
+
assert_equal([].sort, editor.deleted_files)
|
472
|
+
assert_equal([].sort, editor.added_files)
|
473
|
+
assert_equal([].sort, editor.updated_dirs)
|
474
|
+
assert_equal([].sort, editor.copied_files)
|
475
|
+
assert_equal([
|
476
|
+
["#{dir3_svn_path}/", "#{dir1_svn_path}/", first_rev]
|
477
|
+
].sort_by{|x| x[0]},
|
478
|
+
editor.copied_dirs)
|
479
|
+
assert_equal([].sort, editor.deleted_dirs)
|
480
|
+
assert_equal([].sort, editor.added_dirs)
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
private
|
485
|
+
def traverse(editor_class, rev, pass_root=false)
|
486
|
+
root = @fs.root
|
487
|
+
base_rev = rev - 1
|
488
|
+
base_root = @fs.root(base_rev)
|
489
|
+
if pass_root
|
490
|
+
editor = editor_class.new(root, base_root)
|
491
|
+
else
|
492
|
+
editor = editor_class.new
|
493
|
+
end
|
494
|
+
base_root.dir_delta("", "", root, "", editor)
|
495
|
+
editor
|
496
|
+
end
|
497
|
+
end
|