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,331 @@
|
|
1
|
+
require "util"
|
2
|
+
|
3
|
+
require "svn/info"
|
4
|
+
|
5
|
+
class SvnInfoTest < Test::Unit::TestCase
|
6
|
+
include SvnTestUtil
|
7
|
+
|
8
|
+
def setup
|
9
|
+
setup_basic
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
teardown_basic
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_info
|
17
|
+
file = "hello.txt"
|
18
|
+
path = File.join(@wc_path, file)
|
19
|
+
log = "test commit\nnew line"
|
20
|
+
FileUtils.touch(path)
|
21
|
+
|
22
|
+
commit_info = make_context(log) do |ctx|
|
23
|
+
ctx.add(path)
|
24
|
+
commit_info = ctx.commit([@wc_path])
|
25
|
+
end
|
26
|
+
|
27
|
+
info = make_info(commit_info.revision)
|
28
|
+
assert_equal(@author, info.author)
|
29
|
+
assert_equal(commit_info.date, info.date)
|
30
|
+
assert_equal(commit_info.revision, info.revision)
|
31
|
+
assert_equal(log, info.log)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_dirs_changed
|
35
|
+
dir = "new_dir"
|
36
|
+
file = "new.txt"
|
37
|
+
dir_path = File.join(@wc_path, dir)
|
38
|
+
file_path = File.join(dir_path, file)
|
39
|
+
log = "added dir"
|
40
|
+
|
41
|
+
commit_info = make_context(log) do |ctx|
|
42
|
+
ctx.mkdir(dir_path)
|
43
|
+
FileUtils.touch(file_path)
|
44
|
+
ctx.add(file_path)
|
45
|
+
commit_info = ctx.commit(@wc_path)
|
46
|
+
end
|
47
|
+
|
48
|
+
info = make_info(commit_info.revision)
|
49
|
+
assert_equal(["/", "#{dir}/"], info.changed_dirs)
|
50
|
+
assert_equal(commit_info.revision, info.revision)
|
51
|
+
assert_equal(log, info.log)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_changed
|
55
|
+
dir = "changed_dir"
|
56
|
+
tmp_dir = "changed_tmp_dir"
|
57
|
+
dir_path = File.join(@wc_path, dir)
|
58
|
+
tmp_dir_path = File.join(@wc_path, tmp_dir)
|
59
|
+
dir_svn_path = dir
|
60
|
+
tmp_dir_svn_path = tmp_dir
|
61
|
+
|
62
|
+
file1 = "changed1.txt"
|
63
|
+
file2 = "changed2.txt"
|
64
|
+
file3 = "changed3.txt"
|
65
|
+
file4 = "changed4.txt"
|
66
|
+
file5 = "changed5.txt"
|
67
|
+
file1_path = File.join(@wc_path, file1)
|
68
|
+
file2_path = File.join(dir_path, file2)
|
69
|
+
file3_path = File.join(@wc_path, file3)
|
70
|
+
file4_path = File.join(dir_path, file4)
|
71
|
+
file5_path = File.join(@wc_path, file5)
|
72
|
+
file1_svn_path = file1
|
73
|
+
file2_svn_path = [dir_svn_path, file2].join("/")
|
74
|
+
file3_svn_path = file3
|
75
|
+
file4_svn_path = [dir_svn_path, file4].join("/")
|
76
|
+
file5_svn_path = file5
|
77
|
+
|
78
|
+
file6 = "changed6.txt"
|
79
|
+
file7 = "changed7.txt"
|
80
|
+
file8 = "changed8.txt"
|
81
|
+
file9 = "changed9.txt"
|
82
|
+
file6_path = File.join(dir_path, file6)
|
83
|
+
file7_path = File.join(@wc_path, file7)
|
84
|
+
file8_path = File.join(dir_path, file8)
|
85
|
+
file9_path = File.join(dir_path, file9)
|
86
|
+
file6_svn_path = [dir_svn_path, file6].join("/")
|
87
|
+
file7_svn_path = file7
|
88
|
+
file8_svn_path = [dir_svn_path, file8].join("/")
|
89
|
+
file9_svn_path = [dir_svn_path, file9].join("/")
|
90
|
+
|
91
|
+
first_rev = nil
|
92
|
+
|
93
|
+
log = "added 2 dirs\nanded 5 files"
|
94
|
+
make_context(log) do |ctx|
|
95
|
+
|
96
|
+
ctx.mkdir([dir_path, tmp_dir_path])
|
97
|
+
FileUtils.touch(file1_path)
|
98
|
+
FileUtils.touch(file2_path)
|
99
|
+
FileUtils.touch(file3_path)
|
100
|
+
FileUtils.touch(file4_path)
|
101
|
+
FileUtils.touch(file5_path)
|
102
|
+
ctx.add(file1_path)
|
103
|
+
ctx.add(file2_path)
|
104
|
+
ctx.add(file3_path)
|
105
|
+
ctx.add(file4_path)
|
106
|
+
ctx.add(file5_path)
|
107
|
+
|
108
|
+
commit_info = ctx.commit(@wc_path)
|
109
|
+
first_rev = commit_info.revision
|
110
|
+
|
111
|
+
info = make_info(commit_info.revision)
|
112
|
+
assert_equal([].sort, info.updated_dirs)
|
113
|
+
assert_equal([].sort, info.deleted_dirs)
|
114
|
+
assert_equal(["#{dir_svn_path}/", "#{tmp_dir_svn_path}/"].sort,
|
115
|
+
info.added_dirs)
|
116
|
+
|
117
|
+
File.open(file1_path, "w") {|f| f.puts "changed"}
|
118
|
+
File.open(file2_path, "w") {|f| f.puts "changed"}
|
119
|
+
File.open(file3_path, "w") {|f| f.puts "changed"}
|
120
|
+
end
|
121
|
+
|
122
|
+
log = "changed 3 files\ndeleted 2 files\nadded 3 files"
|
123
|
+
make_context(log) do |ctx|
|
124
|
+
ctx.rm_f([file4_path, file5_path])
|
125
|
+
FileUtils.touch(file6_path)
|
126
|
+
FileUtils.touch(file7_path)
|
127
|
+
FileUtils.touch(file8_path)
|
128
|
+
ctx.add(file6_path)
|
129
|
+
ctx.add(file7_path)
|
130
|
+
ctx.add(file8_path)
|
131
|
+
ctx.cp(file1_path, file9_path)
|
132
|
+
ctx.rm(tmp_dir_path)
|
133
|
+
|
134
|
+
commit_info = ctx.commit(@wc_path)
|
135
|
+
second_rev = commit_info.revision
|
136
|
+
|
137
|
+
info = make_info(commit_info.revision)
|
138
|
+
assert_equal([file1_svn_path, file2_svn_path, file3_svn_path].sort,
|
139
|
+
info.updated_files)
|
140
|
+
assert_equal([file4_svn_path, file5_svn_path].sort,
|
141
|
+
info.deleted_files)
|
142
|
+
assert_equal([file6_svn_path, file7_svn_path, file8_svn_path].sort,
|
143
|
+
info.added_files)
|
144
|
+
assert_equal([].sort, info.updated_dirs)
|
145
|
+
assert_equal([
|
146
|
+
[file9_svn_path, file1_svn_path, first_rev]
|
147
|
+
].sort_by{|x| x[0]},
|
148
|
+
info.copied_files)
|
149
|
+
assert_equal([], info.copied_dirs)
|
150
|
+
assert_equal(["#{tmp_dir_svn_path}/"].sort, info.deleted_dirs)
|
151
|
+
assert_equal([].sort, info.added_dirs)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_diff
|
156
|
+
log = "diff"
|
157
|
+
make_context(log) do |ctx|
|
158
|
+
|
159
|
+
file1 = "diff1.txt"
|
160
|
+
file2 = "diff2.txt"
|
161
|
+
file3 = "diff3.txt"
|
162
|
+
file1_path = File.join(@wc_path, "diff1.txt")
|
163
|
+
file2_path = File.join(@wc_path, "diff2.txt")
|
164
|
+
file3_path = File.join(@wc_path, "diff3.txt")
|
165
|
+
file1_prop_key = "AAA"
|
166
|
+
file1_prop_value = "BBB"
|
167
|
+
FileUtils.touch(file1_path)
|
168
|
+
File.open(file2_path, "w") {|f| f.puts "changed"}
|
169
|
+
FileUtils.touch(file3_path)
|
170
|
+
|
171
|
+
ctx.add(file1_path)
|
172
|
+
ctx.add(file2_path)
|
173
|
+
ctx.add(file3_path)
|
174
|
+
ctx.propset(file1_prop_key, file1_prop_value, file1_path)
|
175
|
+
|
176
|
+
ctx.commit(@wc_path)
|
177
|
+
|
178
|
+
file4 = "diff4.txt"
|
179
|
+
file5 = "diff5.txt"
|
180
|
+
file4_path = File.join(@wc_path, file4)
|
181
|
+
file5_path = File.join(@wc_path, file5)
|
182
|
+
file4_prop_key = "XXX"
|
183
|
+
file4_prop_value = "YYY"
|
184
|
+
File.open(file1_path, "w") {|f| f.puts "changed"}
|
185
|
+
File.open(file2_path, "wb") {|f| f.puts "removed\nadded"}
|
186
|
+
FileUtils.touch(file4_path)
|
187
|
+
ctx.add(file4_path)
|
188
|
+
ctx.propdel(file1_prop_key, file1_path)
|
189
|
+
ctx.propset(file4_prop_key, file4_prop_value, file4_path)
|
190
|
+
ctx.cp(file3_path, file5_path)
|
191
|
+
|
192
|
+
commit_info = ctx.commit(@wc_path)
|
193
|
+
|
194
|
+
info = make_info(commit_info.revision)
|
195
|
+
keys = info.diffs.keys.sort
|
196
|
+
file5_key = keys.last
|
197
|
+
assert_equal(4, info.diffs.size)
|
198
|
+
assert_equal([file1, file2, file4].sort, keys[0..-2])
|
199
|
+
assert_match(/\A#{file5}/, file5_key)
|
200
|
+
assert(info.diffs[file1].has_key?(:modified))
|
201
|
+
assert(info.diffs[file1].has_key?(:property_changed))
|
202
|
+
assert(info.diffs[file2].has_key?(:modified))
|
203
|
+
assert(info.diffs[file4].has_key?(:added))
|
204
|
+
assert(info.diffs[file4].has_key?(:property_changed))
|
205
|
+
assert(info.diffs[file5_key].has_key?(:copied))
|
206
|
+
assert_equal(1, info.diffs[file1][:modified].added_line)
|
207
|
+
assert_equal(0, info.diffs[file1][:modified].deleted_line)
|
208
|
+
assert_equal(2, info.diffs[file2][:modified].added_line)
|
209
|
+
assert_equal(1, info.diffs[file2][:modified].deleted_line)
|
210
|
+
assert_equal(0, info.diffs[file4][:added].added_line)
|
211
|
+
assert_equal(0, info.diffs[file4][:added].deleted_line)
|
212
|
+
assert_equal(0, info.diffs[file5_key][:copied].added_line)
|
213
|
+
assert_equal(0, info.diffs[file5_key][:copied].deleted_line)
|
214
|
+
assert_equal("Name: #{file1_prop_key}\n - #{file1_prop_value}\n",
|
215
|
+
info.diffs[file1][:property_changed].body)
|
216
|
+
assert_equal("Name: #{file4_prop_key}\n + #{file4_prop_value}\n",
|
217
|
+
info.diffs[file4][:property_changed].body)
|
218
|
+
assert_equal(commit_info.revision, info.revision)
|
219
|
+
assert_equal(log, info.log)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_diff_path
|
224
|
+
log = "diff path"
|
225
|
+
make_context(log) do |ctx|
|
226
|
+
|
227
|
+
parent_dir = "parent_dir"
|
228
|
+
child_dir = "child_dir"
|
229
|
+
parent_dir_path = File.join(@wc_path, parent_dir)
|
230
|
+
child_dir_path = File.join(parent_dir_path, child_dir)
|
231
|
+
parent_dir_svn_path = parent_dir
|
232
|
+
child_dir_svn_path = [parent_dir, child_dir].join("/")
|
233
|
+
|
234
|
+
ctx.mkdir([parent_dir_path, child_dir_path])
|
235
|
+
|
236
|
+
file1 = "diff1.txt"
|
237
|
+
file2 = "diff2.txt"
|
238
|
+
file1_path = File.join(@wc_path, file1)
|
239
|
+
file2_path = File.join(child_dir_path, file2)
|
240
|
+
file1_svn_path = file1
|
241
|
+
file2_svn_path = [child_dir_svn_path, file2].join("/")
|
242
|
+
File.open(file1_path, "w") {|f| f.puts "new"}
|
243
|
+
File.open(file2_path, "w") {|f| f.puts "deep"}
|
244
|
+
ctx.add(file1_path)
|
245
|
+
ctx.add(file2_path)
|
246
|
+
|
247
|
+
commit_info = ctx.commit(@wc_path)
|
248
|
+
|
249
|
+
info = make_info(commit_info.revision)
|
250
|
+
assert_equal(2, info.diffs.size)
|
251
|
+
assert(info.diffs.has_key?(file1_svn_path))
|
252
|
+
assert(info.diffs.has_key?(file2_svn_path))
|
253
|
+
assert(info.diffs[file1_svn_path].has_key?(:added))
|
254
|
+
assert(info.diffs[file2_svn_path].has_key?(:added))
|
255
|
+
assert_equal(1, info.diffs[file1_svn_path][:added].added_line)
|
256
|
+
assert_equal(0, info.diffs[file1_svn_path][:added].deleted_line)
|
257
|
+
assert_equal(1, info.diffs[file2_svn_path][:added].added_line)
|
258
|
+
assert_equal(0, info.diffs[file2_svn_path][:added].deleted_line)
|
259
|
+
|
260
|
+
|
261
|
+
file3 = "diff3.txt"
|
262
|
+
file4 = "diff4.txt"
|
263
|
+
file3_path = File.join(parent_dir_path, file3)
|
264
|
+
file4_path = File.join(child_dir_path, file4)
|
265
|
+
file3_svn_path = [parent_dir_svn_path, file3].join("/")
|
266
|
+
file4_svn_path = [child_dir_svn_path, file4].join("/")
|
267
|
+
|
268
|
+
ctx.mv(file2_path, file3_path)
|
269
|
+
ctx.mv(file1_path, file4_path)
|
270
|
+
|
271
|
+
commit_info = ctx.commit(@wc_path)
|
272
|
+
|
273
|
+
info = make_info(commit_info.revision)
|
274
|
+
assert_equal([
|
275
|
+
file1_svn_path,
|
276
|
+
file2_svn_path,
|
277
|
+
file3_svn_path,
|
278
|
+
file4_svn_path,
|
279
|
+
].sort,
|
280
|
+
info.diffs.keys.sort)
|
281
|
+
assert(info.diffs[file1_svn_path].has_key?(:deleted))
|
282
|
+
assert(info.diffs[file2_svn_path].has_key?(:deleted))
|
283
|
+
assert(info.diffs[file3_svn_path].has_key?(:copied))
|
284
|
+
assert(info.diffs[file4_svn_path].has_key?(:copied))
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
def test_sha256
|
289
|
+
log = "sha256"
|
290
|
+
make_context(log) do |ctx|
|
291
|
+
|
292
|
+
file1 = "diff1.txt"
|
293
|
+
file2 = "diff2.txt"
|
294
|
+
file3 = "diff3.txt"
|
295
|
+
file1_path = File.join(@wc_path, "diff1.txt")
|
296
|
+
file2_path = File.join(@wc_path, "diff2.txt")
|
297
|
+
file3_path = File.join(@wc_path, "diff3.txt")
|
298
|
+
file1_content = file1
|
299
|
+
file2_content = file2
|
300
|
+
file3_content = file3
|
301
|
+
all_content = [file1, file2, file3].sort.join("")
|
302
|
+
File.open(file1_path, "w") {|f| f.print file1_content}
|
303
|
+
File.open(file2_path, "w") {|f| f.print file2_content}
|
304
|
+
File.open(file3_path, "w") {|f| f.print file3_content}
|
305
|
+
|
306
|
+
ctx.add(file1_path)
|
307
|
+
ctx.add(file2_path)
|
308
|
+
ctx.add(file3_path)
|
309
|
+
|
310
|
+
commit_info = ctx.commit(@wc_path)
|
311
|
+
|
312
|
+
info = make_info(commit_info.revision)
|
313
|
+
assert_equal(3, info.sha256.size)
|
314
|
+
assert_equal(Digest::SHA256.hexdigest(file1_content),
|
315
|
+
info.sha256[file1][:sha256])
|
316
|
+
assert_equal(Digest::SHA256.hexdigest(file2_content),
|
317
|
+
info.sha256[file2][:sha256])
|
318
|
+
assert_equal(Digest::SHA256.hexdigest(file3_content),
|
319
|
+
info.sha256[file3][:sha256])
|
320
|
+
assert_equal(Digest::SHA256.hexdigest(all_content),
|
321
|
+
info.entire_sha256)
|
322
|
+
assert_equal(commit_info.revision, info.revision)
|
323
|
+
assert_equal(log, info.log)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
def make_info(rev=nil)
|
328
|
+
Svn::Info.new(@repos_path, rev || @fs.youngest_rev)
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
@@ -0,0 +1,436 @@
|
|
1
|
+
require "util"
|
2
|
+
|
3
|
+
require "svn/ra"
|
4
|
+
|
5
|
+
class SvnRaTest < Test::Unit::TestCase
|
6
|
+
include SvnTestUtil
|
7
|
+
|
8
|
+
def setup
|
9
|
+
setup_basic
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
teardown_basic
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_version
|
17
|
+
assert_equal(Svn::Core.subr_version, Svn::Ra.version)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_uuid
|
21
|
+
Svn::Ra::Session.open(@repos_uri) do |session|
|
22
|
+
assert_equal(File.read(File.join(@repos_path, "db", "uuid")).strip,
|
23
|
+
session.uuid)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_open_without_callback
|
28
|
+
assert_nothing_raised do
|
29
|
+
Svn::Ra::Session.open(@repos_uri).close
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_session
|
34
|
+
log = "sample log"
|
35
|
+
log2 = "sample log2"
|
36
|
+
file = "sample.txt"
|
37
|
+
src = "sample source"
|
38
|
+
path = File.join(@wc_path, file)
|
39
|
+
|
40
|
+
session = nil
|
41
|
+
rev1 = nil
|
42
|
+
path_props = nil
|
43
|
+
|
44
|
+
make_context(log) do |ctx0|
|
45
|
+
config = {}
|
46
|
+
path_props = {"my-prop" => "value"}
|
47
|
+
callbacks = Svn::Ra::Callbacks.new(ctx0.auth_baton)
|
48
|
+
Svn::Ra::Session.open(@repos_uri, config,callbacks) do |session|
|
49
|
+
|
50
|
+
assert_equal(youngest_rev, session.latest_revnum)
|
51
|
+
assert_equal(@repos_uri, session.repos_root)
|
52
|
+
|
53
|
+
File.open(path, "w") {|f| f.print(src)}
|
54
|
+
ctx0.add(path)
|
55
|
+
info = ctx0.ci(@wc_path)
|
56
|
+
rev1 = info.revision
|
57
|
+
|
58
|
+
assert_equal(info.revision, session.dated_revision(info.date))
|
59
|
+
content, props = session.file(file, info.revision)
|
60
|
+
assert_equal(src, content)
|
61
|
+
assert_equal([
|
62
|
+
Svn::Core::PROP_ENTRY_COMMITTED_DATE,
|
63
|
+
Svn::Core::PROP_ENTRY_UUID,
|
64
|
+
Svn::Core::PROP_ENTRY_LAST_AUTHOR,
|
65
|
+
Svn::Core::PROP_ENTRY_COMMITTED_REV,
|
66
|
+
].sort,
|
67
|
+
props.keys.sort)
|
68
|
+
entries, props = session.dir("", info.revision)
|
69
|
+
assert_equal([file], entries.keys)
|
70
|
+
assert(entries[file].file?)
|
71
|
+
assert_equal([
|
72
|
+
Svn::Core::PROP_ENTRY_COMMITTED_DATE,
|
73
|
+
Svn::Core::PROP_ENTRY_UUID,
|
74
|
+
Svn::Core::PROP_ENTRY_LAST_AUTHOR,
|
75
|
+
Svn::Core::PROP_ENTRY_COMMITTED_REV,
|
76
|
+
].sort,
|
77
|
+
props.keys.sort)
|
78
|
+
|
79
|
+
entries, props = session.dir("", info.revision, Svn::Core::DIRENT_KIND)
|
80
|
+
assert_equal(Svn::Core::NODE_FILE, entries[file].kind)
|
81
|
+
entries, props = session.dir("", info.revision, 0)
|
82
|
+
assert_equal(Svn::Core::NODE_NONE, entries[file].kind)
|
83
|
+
|
84
|
+
make_context(log2) do |ctx|
|
85
|
+
File.open(path, "w") {|f| f.print(src * 2)}
|
86
|
+
path_props.each do |key, value|
|
87
|
+
ctx.prop_set(key, value, path)
|
88
|
+
end
|
89
|
+
info = ctx.ci(@wc_path)
|
90
|
+
rev2 = info.revision
|
91
|
+
|
92
|
+
logs = []
|
93
|
+
receiver = Proc.new do |changed_paths, revision, author, date, message|
|
94
|
+
logs << [revision, message]
|
95
|
+
end
|
96
|
+
session.log([file], rev1, rev2, rev2 - rev1 + 1, &receiver)
|
97
|
+
assert_equal([
|
98
|
+
[rev1, log],
|
99
|
+
[rev2, log2],
|
100
|
+
].sort_by {|rev, log| rev},
|
101
|
+
logs.sort_by {|rev, log| rev})
|
102
|
+
|
103
|
+
assert_equal(Svn::Core::NODE_FILE, session.check_path(file))
|
104
|
+
assert_equal(Svn::Core::NODE_FILE, session.stat(file).kind)
|
105
|
+
|
106
|
+
assert_equal({
|
107
|
+
rev1 => "/#{file}",
|
108
|
+
rev2 => "/#{file}",
|
109
|
+
},
|
110
|
+
session.locations(file, [rev1, rev2]))
|
111
|
+
|
112
|
+
infos = []
|
113
|
+
session.file_revs(file, rev1, rev2) do |_path, rev, rev_props, prop_diffs|
|
114
|
+
hashed_prop_diffs = {}
|
115
|
+
prop_diffs.each do |prop|
|
116
|
+
hashed_prop_diffs[prop.name] = prop.value
|
117
|
+
end
|
118
|
+
infos << [rev, _path, hashed_prop_diffs]
|
119
|
+
end
|
120
|
+
assert_equal([
|
121
|
+
[rev1, "/#{file}", {}],
|
122
|
+
[rev2, "/#{file}", path_props],
|
123
|
+
],
|
124
|
+
infos)
|
125
|
+
|
126
|
+
infos = []
|
127
|
+
session.file_revs2(file, rev1, rev2) do |_path, rev, rev_props, prop_diffs|
|
128
|
+
infos << [rev, _path, prop_diffs]
|
129
|
+
end
|
130
|
+
assert_equal([
|
131
|
+
[rev1, "/#{file}", {}],
|
132
|
+
[rev2, "/#{file}", path_props],
|
133
|
+
],
|
134
|
+
infos)
|
135
|
+
|
136
|
+
assert_equal({}, session.get_locks(""))
|
137
|
+
locks = []
|
138
|
+
session.lock({file => rev2}) do |_path, do_lock, lock, ra_err|
|
139
|
+
locks << [_path, do_lock, lock, ra_err]
|
140
|
+
end
|
141
|
+
assert_equal([file],
|
142
|
+
locks.collect{|_path, *rest| _path}.sort)
|
143
|
+
lock = locks.assoc(file)[2]
|
144
|
+
assert_equal(["/#{file}"],
|
145
|
+
session.get_locks("").collect{|_path, *rest| _path})
|
146
|
+
assert_equal(lock.token, session.get_lock(file).token)
|
147
|
+
assert_equal([lock.token],
|
148
|
+
session.get_locks(file).values.collect{|l| l.token})
|
149
|
+
session.unlock({file => lock.token})
|
150
|
+
assert_equal({}, session.get_locks(file))
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def assert_property_access
|
157
|
+
log = "sample log"
|
158
|
+
file = "sample.txt"
|
159
|
+
path = File.join(@wc_path, file)
|
160
|
+
make_context(log) do |ctx|
|
161
|
+
config = {}
|
162
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
163
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
164
|
+
|
165
|
+
FileUtils.touch(path)
|
166
|
+
ctx.add(path)
|
167
|
+
info = ctx.commit(@wc_path)
|
168
|
+
|
169
|
+
assert_equal(@author, yield(session, :get, Svn::Core::PROP_REVISION_AUTHOR))
|
170
|
+
assert_equal(log, yield(session, :get, Svn::Core::PROP_REVISION_LOG))
|
171
|
+
assert_equal([
|
172
|
+
Svn::Core::PROP_REVISION_AUTHOR,
|
173
|
+
Svn::Core::PROP_REVISION_DATE,
|
174
|
+
Svn::Core::PROP_REVISION_LOG,
|
175
|
+
].sort,
|
176
|
+
yield(session, :list).keys.sort)
|
177
|
+
yield(session, :set, Svn::Core::PROP_REVISION_LOG, nil)
|
178
|
+
assert_nil(yield(session, :get ,Svn::Core::PROP_REVISION_LOG))
|
179
|
+
assert_equal([
|
180
|
+
Svn::Core::PROP_REVISION_AUTHOR,
|
181
|
+
Svn::Core::PROP_REVISION_DATE,
|
182
|
+
].sort,
|
183
|
+
yield(session, :list).keys.sort)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_prop
|
189
|
+
assert_property_access do |session, action, *args|
|
190
|
+
case action
|
191
|
+
when :get
|
192
|
+
key, = args
|
193
|
+
session[key]
|
194
|
+
when :set
|
195
|
+
key, value = args
|
196
|
+
session[key] = value
|
197
|
+
when :list
|
198
|
+
session.properties
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_prop_with_no_ruby_way
|
204
|
+
assert_property_access do |session, action, *args|
|
205
|
+
case action
|
206
|
+
when :get
|
207
|
+
key, = args
|
208
|
+
session.prop(key)
|
209
|
+
when :set
|
210
|
+
key, value = args
|
211
|
+
session.set_prop(key, value)
|
212
|
+
when :list
|
213
|
+
session.proplist
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_callback
|
219
|
+
log = "sample log"
|
220
|
+
file = "sample.txt"
|
221
|
+
src1 = "sample source1"
|
222
|
+
src2 = "sample source2"
|
223
|
+
path = File.join(@wc_path, file)
|
224
|
+
path_in_repos = "/#{file}"
|
225
|
+
make_context(log) do |ctx|
|
226
|
+
config = {}
|
227
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
228
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
229
|
+
|
230
|
+
File.open(path, "w") {|f| f.print(src1)}
|
231
|
+
ctx.add(path)
|
232
|
+
rev1 = ctx.ci(@wc_path).revision
|
233
|
+
|
234
|
+
File.open(path, "w") {|f| f.print(src2)}
|
235
|
+
rev2 = ctx.ci(@wc_path).revision
|
236
|
+
|
237
|
+
ctx.up(@wc_path)
|
238
|
+
|
239
|
+
editor, editor_baton = session.commit_editor(log) {}
|
240
|
+
reporter = session.update(rev2, "", editor, editor_baton)
|
241
|
+
reporter.abort_report
|
242
|
+
|
243
|
+
editor, editor_baton = session.commit_editor(log) {}
|
244
|
+
reporter = session.update2(rev2, "", editor)
|
245
|
+
reporter.abort_report
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
def test_diff
|
251
|
+
log = "sample log"
|
252
|
+
file = "sample.txt"
|
253
|
+
src1 = "a\nb\nc\nd\ne\n"
|
254
|
+
src2 = "a\nb\nC\nd\ne\n"
|
255
|
+
path = File.join(@wc_path, file)
|
256
|
+
path_in_repos = "/#{file}"
|
257
|
+
make_context(log) do |ctx|
|
258
|
+
config = {}
|
259
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
260
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
261
|
+
|
262
|
+
File.open(path, "w") {|f| f.print(src1)}
|
263
|
+
ctx.add(path)
|
264
|
+
rev1 = ctx.ci(@wc_path).revision
|
265
|
+
|
266
|
+
File.open(path, "w") {|f| f.print(src2)}
|
267
|
+
rev2 = ctx.ci(@wc_path).revision
|
268
|
+
|
269
|
+
ctx.up(@wc_path)
|
270
|
+
|
271
|
+
editor = Svn::Delta::BaseEditor.new # dummy
|
272
|
+
reporter = session.diff(rev2, "", @repos_uri, editor)
|
273
|
+
reporter.set_path("", rev1, false, nil)
|
274
|
+
reporter.finish_report
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
def test_commit_editor
|
280
|
+
log = "sample log"
|
281
|
+
dir_uri = "/test"
|
282
|
+
config = {}
|
283
|
+
make_context(log) do |ctx|
|
284
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
285
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
286
|
+
actual_info = nil
|
287
|
+
actual_date = nil
|
288
|
+
|
289
|
+
expected_info = [1, @author]
|
290
|
+
start_time = Time.now
|
291
|
+
gc_disable do
|
292
|
+
editor, baton = session.commit_editor(log) do |rev, date, author|
|
293
|
+
actual_info = [rev, author]
|
294
|
+
actual_date = date
|
295
|
+
end
|
296
|
+
editor.baton = baton
|
297
|
+
|
298
|
+
root = editor.open_root(-1)
|
299
|
+
editor.add_directory(dir_uri, root, nil, -1)
|
300
|
+
gc_enable do
|
301
|
+
GC.start
|
302
|
+
editor.close_edit
|
303
|
+
end
|
304
|
+
assert_equal(expected_info, actual_info)
|
305
|
+
assert_operator(start_time..(Time.now), :include?, actual_date)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_commit_editor2
|
312
|
+
log = "sample log"
|
313
|
+
dir_uri = "/test"
|
314
|
+
config = {}
|
315
|
+
make_context(log) do |ctx|
|
316
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
317
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
318
|
+
actual_info = nil
|
319
|
+
actual_date = nil
|
320
|
+
|
321
|
+
expected_info = [1, @author]
|
322
|
+
start_time = Time.now
|
323
|
+
gc_disable do
|
324
|
+
editor = session.commit_editor2(log) do |info|
|
325
|
+
actual_info = [info.revision, info.author]
|
326
|
+
actual_date = info.date
|
327
|
+
end
|
328
|
+
|
329
|
+
root = editor.open_root(-1)
|
330
|
+
editor.add_directory(dir_uri, root, nil, -1)
|
331
|
+
gc_enable do
|
332
|
+
GC.start
|
333
|
+
editor.close_edit
|
334
|
+
end
|
335
|
+
assert_equal(expected_info, actual_info)
|
336
|
+
assert_operator(start_time..(Time.now), :include?, actual_date)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
def test_reparent
|
343
|
+
log = "sample log"
|
344
|
+
dir = "dir"
|
345
|
+
deep_dir = "deep"
|
346
|
+
dir_path = File.join(@wc_path, dir)
|
347
|
+
deep_dir_path = File.join(dir_path, deep_dir)
|
348
|
+
config = {}
|
349
|
+
make_context(log) do |ctx|
|
350
|
+
|
351
|
+
ctx.mkdir(dir_path)
|
352
|
+
ctx.ci(@wc_path)
|
353
|
+
|
354
|
+
ctx.mkdir(deep_dir_path)
|
355
|
+
ctx.ci(@wc_path)
|
356
|
+
|
357
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
358
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
359
|
+
|
360
|
+
entries, props = session.dir(dir, nil)
|
361
|
+
assert_equal([deep_dir], entries.keys)
|
362
|
+
assert_raise(Svn::Error::FS_NOT_FOUND) do
|
363
|
+
session.dir(deep_dir)
|
364
|
+
end
|
365
|
+
|
366
|
+
session.reparent("#{@repos_uri}/#{dir}")
|
367
|
+
assert_raise(Svn::Error::FS_NOT_FOUND) do
|
368
|
+
session.dir(dir)
|
369
|
+
end
|
370
|
+
entries, props = session.dir(deep_dir)
|
371
|
+
assert_equal([], entries.keys)
|
372
|
+
|
373
|
+
assert_raise(Svn::Error::RA_ILLEGAL_URL) do
|
374
|
+
session.reparent("file:///tmp/xxx")
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
def test_mergeinfo
|
381
|
+
log = "sample log"
|
382
|
+
file = "sample.txt"
|
383
|
+
src = "sample\n"
|
384
|
+
config = {}
|
385
|
+
trunk = File.join(@wc_path, "trunk")
|
386
|
+
branch = File.join(@wc_path, "branch")
|
387
|
+
trunk_path = File.join(trunk, file)
|
388
|
+
branch_path = File.join(branch, file)
|
389
|
+
session_relative_trunk_path = "trunk"
|
390
|
+
repository_branch_path = "/branch"
|
391
|
+
|
392
|
+
make_context(log) do |ctx|
|
393
|
+
ctx.mkdir(trunk, branch)
|
394
|
+
File.open(trunk_path, "w") {}
|
395
|
+
File.open(branch_path, "w") {}
|
396
|
+
ctx.add(trunk_path)
|
397
|
+
ctx.add(branch_path)
|
398
|
+
rev1 = ctx.commit(@wc_path).revision
|
399
|
+
|
400
|
+
File.open(branch_path, "w") {|f| f.print(src)}
|
401
|
+
rev2 = ctx.commit(@wc_path).revision
|
402
|
+
|
403
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
404
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
405
|
+
|
406
|
+
assert_nil(session.mergeinfo(session_relative_trunk_path))
|
407
|
+
ctx.merge(branch, rev1, branch, rev2, trunk)
|
408
|
+
assert_nil(session.mergeinfo(session_relative_trunk_path))
|
409
|
+
|
410
|
+
rev3 = ctx.commit(@wc_path).revision
|
411
|
+
mergeinfo = session.mergeinfo(session_relative_trunk_path)
|
412
|
+
assert_equal([session_relative_trunk_path], mergeinfo.keys)
|
413
|
+
trunk_mergeinfo = mergeinfo[session_relative_trunk_path]
|
414
|
+
assert_equal([repository_branch_path], trunk_mergeinfo.keys)
|
415
|
+
assert_equal([[1, 2, true]],
|
416
|
+
trunk_mergeinfo[repository_branch_path].collect {|range|
|
417
|
+
range.to_a})
|
418
|
+
|
419
|
+
ctx.rm(branch_path)
|
420
|
+
rev4 = ctx.commit(@wc_path).revision
|
421
|
+
|
422
|
+
ctx.merge(branch, rev3, branch, rev4, trunk)
|
423
|
+
assert(!File.exist?(trunk_path))
|
424
|
+
rev5 = ctx.commit(@wc_path).revision
|
425
|
+
|
426
|
+
mergeinfo = session.mergeinfo(session_relative_trunk_path, rev5)
|
427
|
+
assert_equal([session_relative_trunk_path], mergeinfo.keys)
|
428
|
+
trunk_mergeinfo = mergeinfo[session_relative_trunk_path]
|
429
|
+
assert_equal([repository_branch_path], trunk_mergeinfo.keys)
|
430
|
+
assert_equal([[1, 2, true], [3, 4, true]],
|
431
|
+
trunk_mergeinfo[repository_branch_path].collect {|range|
|
432
|
+
range.to_a})
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|