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,18 @@
|
|
1
|
+
require "my-assertions"
|
2
|
+
|
3
|
+
require "svn/core"
|
4
|
+
require "svn/util"
|
5
|
+
|
6
|
+
class SvnUtilTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def test_to_ruby_const_name
|
9
|
+
assert_equal("ABC", Svn::Util.to_ruby_const_name("abc"))
|
10
|
+
assert_equal("ABC_DEF", Svn::Util.to_ruby_const_name("abc_def"))
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_to_ruby_class_name
|
14
|
+
assert_equal("Abc", Svn::Util.to_ruby_class_name("abc"))
|
15
|
+
assert_equal("AbcDef", Svn::Util.to_ruby_class_name("abc_def"))
|
16
|
+
assert_equal("AbcDef", Svn::Util.to_ruby_class_name("ABC_DEF"))
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,1063 @@
|
|
1
|
+
require "my-assertions"
|
2
|
+
require "util"
|
3
|
+
|
4
|
+
require "svn/core"
|
5
|
+
require "svn/wc"
|
6
|
+
require "svn/repos"
|
7
|
+
require "svn/ra"
|
8
|
+
|
9
|
+
class SvnWcTest < Test::Unit::TestCase
|
10
|
+
include SvnTestUtil
|
11
|
+
|
12
|
+
def setup
|
13
|
+
setup_basic
|
14
|
+
end
|
15
|
+
|
16
|
+
def teardown
|
17
|
+
teardown_basic
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_version
|
21
|
+
assert_equal(Svn::Core.subr_version, Svn::Wc.version)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_status
|
25
|
+
file1 = "a"
|
26
|
+
file1_path = File.join(@wc_path, file1)
|
27
|
+
|
28
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, false, 0) do |adm|
|
29
|
+
status = adm.status(file1_path)
|
30
|
+
assert_equal(Svn::Wc::STATUS_NONE, status.text_status)
|
31
|
+
assert_nil(status.entry)
|
32
|
+
end
|
33
|
+
|
34
|
+
non_exist_child_path = File.join(@wc_path, "NOT-EXIST")
|
35
|
+
assert_nothing_raised do
|
36
|
+
Svn::Wc::AdmAccess.probe_open(nil, non_exist_child_path, false, 0){}
|
37
|
+
end
|
38
|
+
|
39
|
+
FileUtils.touch(file1_path)
|
40
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, false, 0) do |adm|
|
41
|
+
status = adm.status(file1_path)
|
42
|
+
assert_equal(Svn::Wc::STATUS_UNVERSIONED, status.text_status)
|
43
|
+
assert_nil(status.entry)
|
44
|
+
end
|
45
|
+
|
46
|
+
log = "sample log"
|
47
|
+
make_context(log) do |ctx|
|
48
|
+
ctx.add(file1_path)
|
49
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, false, 0) do |adm|
|
50
|
+
status = adm.status(file1_path)
|
51
|
+
assert_equal(Svn::Wc::STATUS_ADDED, status.text_status)
|
52
|
+
end
|
53
|
+
|
54
|
+
commit_info = ctx.commit(@wc_path)
|
55
|
+
|
56
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, false, 0) do |adm|
|
57
|
+
status = adm.status(file1_path)
|
58
|
+
assert_equal(Svn::Wc::STATUS_NORMAL, status.text_status)
|
59
|
+
assert_equal(commit_info.revision, status.entry.revision)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_wc
|
65
|
+
assert_not_equal(0, Svn::Wc.check_wc(@wc_path))
|
66
|
+
assert(Svn::Wc.normal_prop?("name"))
|
67
|
+
assert(Svn::Wc.wc_prop?("#{Svn::Core::PROP_WC_PREFIX}name"))
|
68
|
+
assert(Svn::Wc.entry_prop?("#{Svn::Core::PROP_ENTRY_PREFIX}name"))
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_adm_access
|
72
|
+
log = "sample log"
|
73
|
+
source = "sample source"
|
74
|
+
dir = "dir"
|
75
|
+
file = "file"
|
76
|
+
prop_name = "name"
|
77
|
+
prop_value = "value"
|
78
|
+
dir_path = File.join(@wc_path, dir)
|
79
|
+
path = File.join(dir_path, file)
|
80
|
+
make_context(log) do |ctx|
|
81
|
+
|
82
|
+
ctx.mkdir(dir_path)
|
83
|
+
File.open(path, "w") {|f| f.print(source)}
|
84
|
+
ctx.add(path)
|
85
|
+
rev = ctx.ci(@wc_path).revision
|
86
|
+
|
87
|
+
result = Svn::Wc::AdmAccess.open_anchor(path, true, 5)
|
88
|
+
anchor_access, target_access, target = result
|
89
|
+
|
90
|
+
assert_equal(file, target)
|
91
|
+
assert_equal(dir_path, anchor_access.path)
|
92
|
+
assert_equal(dir_path, target_access.path)
|
93
|
+
|
94
|
+
assert(anchor_access.locked?)
|
95
|
+
assert(target_access.locked?)
|
96
|
+
|
97
|
+
assert(!target_access.has_binary_prop?(path))
|
98
|
+
assert(!target_access.text_modified?(path))
|
99
|
+
assert(!target_access.props_modified?(path))
|
100
|
+
|
101
|
+
File.open(path, "w") {|f| f.print(source * 2)}
|
102
|
+
target_access.set_prop(prop_name, prop_value, path)
|
103
|
+
assert_equal(prop_value, target_access.prop(prop_name, path))
|
104
|
+
assert_equal({prop_name => prop_value},
|
105
|
+
target_access.prop_list(path))
|
106
|
+
assert(target_access.text_modified?(path))
|
107
|
+
assert(target_access.props_modified?(path))
|
108
|
+
|
109
|
+
target_access.set_prop("name", nil, path)
|
110
|
+
assert(!target_access.props_modified?(path))
|
111
|
+
|
112
|
+
target_access.revert(path)
|
113
|
+
assert(!target_access.text_modified?(path))
|
114
|
+
assert(!target_access.props_modified?(path))
|
115
|
+
|
116
|
+
anchor_access.close
|
117
|
+
target_access.close
|
118
|
+
|
119
|
+
access = Svn::Wc::AdmAccess.probe_open(nil, path, false, 5)
|
120
|
+
assert(!Svn::Wc.default_ignores({}).empty?)
|
121
|
+
assert_equal(Svn::Wc.default_ignores({}), access.ignores({}))
|
122
|
+
assert(access.wc_root?(@wc_path))
|
123
|
+
|
124
|
+
access = Svn::Wc::AdmAccess.probe_open(nil, @wc_path, false, 5)
|
125
|
+
assert_equal(@wc_path, access.path)
|
126
|
+
assert_equal(dir_path, access.retrieve(dir_path).path)
|
127
|
+
assert_equal(dir_path, access.probe_retrieve(dir_path).path)
|
128
|
+
assert_equal(dir_path, access.probe_try(dir_path, false, 5).path)
|
129
|
+
|
130
|
+
Svn::Wc::AdmAccess.probe_open(nil, @wc_path, false, 5) do |access|
|
131
|
+
assert(!access.locked?)
|
132
|
+
end
|
133
|
+
|
134
|
+
Svn::Wc::AdmAccess.probe_open(nil, @wc_path, true, 5) do |access|
|
135
|
+
assert(access.locked?)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_traversal_info
|
141
|
+
info = Svn::Wc::TraversalInfo.new
|
142
|
+
assert_equal([{}, {}], info.edited_externals)
|
143
|
+
end
|
144
|
+
|
145
|
+
def assert_externals_description
|
146
|
+
dir = "dir"
|
147
|
+
url = "http://svn.example.com/trunk"
|
148
|
+
description = "#{dir} #{url}"
|
149
|
+
items = yield([@wc_path, description])
|
150
|
+
assert_equal([[dir, url]],
|
151
|
+
items.collect {|item| [item.target_dir, item.url]})
|
152
|
+
assert_kind_of(Svn::Wc::ExternalItem2, items.first)
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_externals_description
|
156
|
+
assert_externals_description do |args|
|
157
|
+
Svn::Wc::ExternalsDescription.parse(*args)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_externals_description_for_backward_compatibility
|
162
|
+
assert_externals_description do |args|
|
163
|
+
Svn::Wc.parse_externals_description(*args)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_notify
|
168
|
+
path = @wc_path
|
169
|
+
action = Svn::Wc::NOTIFY_SKIP
|
170
|
+
notify = Svn::Wc::Notify.new(path, action)
|
171
|
+
assert_equal(path, notify.path)
|
172
|
+
assert_equal(action, notify.action)
|
173
|
+
|
174
|
+
notify2 = notify.dup
|
175
|
+
assert_equal(path, notify2.path)
|
176
|
+
assert_equal(action, notify2.action)
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_entry
|
180
|
+
log = "sample log"
|
181
|
+
source1 = "source"
|
182
|
+
source2 = "SOURCE"
|
183
|
+
source3 = "SHOYU"
|
184
|
+
file = "file"
|
185
|
+
path = File.join(@wc_path, file)
|
186
|
+
make_context(log) do |ctx|
|
187
|
+
|
188
|
+
File.open(path, "w") {|f| f.print(source1)}
|
189
|
+
ctx.add(path)
|
190
|
+
rev1 = ctx.ci(@wc_path).revision
|
191
|
+
|
192
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, false, 5) do |access|
|
193
|
+
show = true
|
194
|
+
entry = Svn::Wc::Entry.new(path, access, show)
|
195
|
+
assert_equal(file, entry.name)
|
196
|
+
assert_equal(file, entry.dup.name)
|
197
|
+
|
198
|
+
entries = access.read_entries
|
199
|
+
assert_equal(["", file].sort, entries.keys.sort)
|
200
|
+
entry = entries[file]
|
201
|
+
assert_equal(file, entry.name)
|
202
|
+
|
203
|
+
assert(!entry.conflicted?(@wc_path))
|
204
|
+
end
|
205
|
+
|
206
|
+
File.open(path, "w") {|f| f.print(source2)}
|
207
|
+
rev2 = ctx.ci(@wc_path).revision
|
208
|
+
|
209
|
+
ctx.up(@wc_path, rev1)
|
210
|
+
File.open(path, "w") {|f| f.print(source3)}
|
211
|
+
ctx.up(@wc_path, rev2)
|
212
|
+
|
213
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
214
|
+
entry = access.read_entries[file]
|
215
|
+
assert(entry.conflicted?(@wc_path))
|
216
|
+
assert(entry.text_conflicted?(@wc_path))
|
217
|
+
assert(!entry.prop_conflicted?(@wc_path))
|
218
|
+
|
219
|
+
access.resolved_conflict(path)
|
220
|
+
assert(!entry.conflicted?(@wc_path))
|
221
|
+
|
222
|
+
access.process_committed(@wc_path, rev2 + 1)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_committed_queue
|
228
|
+
log = "sample log"
|
229
|
+
source1 = "source"
|
230
|
+
source2 = "SOURCE"
|
231
|
+
file1 = "file1"
|
232
|
+
file2 = "file2"
|
233
|
+
path1 = File.join(@wc_path, file1)
|
234
|
+
path2 = File.join(@wc_path, file2)
|
235
|
+
make_context(log) do |ctx|
|
236
|
+
|
237
|
+
File.open(path1, "w") {|f| f.print(source1)}
|
238
|
+
File.open(path2, "w") {|f| f.print(source2)}
|
239
|
+
ctx.add(path1)
|
240
|
+
ctx.add(path2)
|
241
|
+
rev1 = ctx.ci(@wc_path).revision
|
242
|
+
next_rev = rev1 + 1
|
243
|
+
|
244
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
245
|
+
queue = Svn::Wc::CommittedQueue.new
|
246
|
+
queue.push(access, path1, true, {"my-prop" => "value"})
|
247
|
+
queue.process(access, next_rev)
|
248
|
+
end
|
249
|
+
|
250
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
251
|
+
queue = Svn::Wc::CommittedQueue.new
|
252
|
+
queue.push(access, path1, true, [Svn::Core::Prop.new("my-prop", "value")])
|
253
|
+
queue.process(access, next_rev)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_ancestry
|
259
|
+
file1 = "file1"
|
260
|
+
file2 = "file2"
|
261
|
+
path1 = File.join(@wc_path, file1)
|
262
|
+
path2 = File.join(@wc_path, file2)
|
263
|
+
log = "sample log"
|
264
|
+
make_context(log) do |ctx|
|
265
|
+
|
266
|
+
FileUtils.touch(path1)
|
267
|
+
ctx.add(path1)
|
268
|
+
rev1 = ctx.ci(@wc_path).revision
|
269
|
+
|
270
|
+
ctx.cp(path1, path2)
|
271
|
+
rev2 = ctx.ci(@wc_path).revision
|
272
|
+
|
273
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, false, 5) do |access|
|
274
|
+
assert_equal(["#{@repos_uri}/#{file2}", rev2],
|
275
|
+
access.ancestry(path2))
|
276
|
+
result = []
|
277
|
+
callbacks = Proc.new do |path, entry|
|
278
|
+
result << [path, entry]
|
279
|
+
end
|
280
|
+
def callbacks.found_entry(path, entry)
|
281
|
+
call(path, entry)
|
282
|
+
end
|
283
|
+
access.walk_entries(@wc_path, callbacks)
|
284
|
+
assert_equal([@wc_path, path1, path2].sort,
|
285
|
+
result.collect{|path, entry| path}.sort)
|
286
|
+
entry = result.assoc(path2)[1]
|
287
|
+
assert_equal(file2, entry.name)
|
288
|
+
|
289
|
+
callbacks = Proc.new do |path, entry|
|
290
|
+
raise Svn::Error::Cancelled
|
291
|
+
end
|
292
|
+
def callbacks.found_entry(path, entry)
|
293
|
+
call(path, entry)
|
294
|
+
end
|
295
|
+
assert_raises(Svn::Error::Cancelled) do
|
296
|
+
access.walk_entries(@wc_path, callbacks)
|
297
|
+
end
|
298
|
+
|
299
|
+
def callbacks.ignored_errors=(value)
|
300
|
+
@ignored_errors = value
|
301
|
+
end
|
302
|
+
def callbacks.handle_error(path, err)
|
303
|
+
@ignored_errors << [path, err] if err
|
304
|
+
end
|
305
|
+
ignored_errors = []
|
306
|
+
callbacks.ignored_errors = ignored_errors
|
307
|
+
access.walk_entries(@wc_path, callbacks)
|
308
|
+
assert_equal([
|
309
|
+
[@wc_path, Svn::Error::Cancelled],
|
310
|
+
[path1, Svn::Error::Cancelled],
|
311
|
+
[path2, Svn::Error::Cancelled],
|
312
|
+
],
|
313
|
+
ignored_errors.collect {|path, err| [path, err.class]})
|
314
|
+
end
|
315
|
+
|
316
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
317
|
+
assert_raises(Svn::Error::WcPathFound) do
|
318
|
+
access.mark_missing_deleted(path1)
|
319
|
+
end
|
320
|
+
FileUtils.rm(path1)
|
321
|
+
access.mark_missing_deleted(path1)
|
322
|
+
access.maybe_set_repos_root(path2, @repos_uri)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
def test_adm_ensure
|
328
|
+
adm_dir = Dir.glob(File.join(@wc_path, "{.,_}svn")).first
|
329
|
+
assert(File.exists?(adm_dir))
|
330
|
+
FileUtils.rm_rf(adm_dir)
|
331
|
+
assert(!File.exists?(adm_dir))
|
332
|
+
Svn::Wc.ensure_adm(@wc_path, nil, @repos_uri, nil, 0)
|
333
|
+
assert(File.exists?(adm_dir))
|
334
|
+
end
|
335
|
+
|
336
|
+
def test_merge
|
337
|
+
left = <<-EOL
|
338
|
+
a
|
339
|
+
b
|
340
|
+
c
|
341
|
+
d
|
342
|
+
e
|
343
|
+
EOL
|
344
|
+
right = <<-EOR
|
345
|
+
A
|
346
|
+
b
|
347
|
+
c
|
348
|
+
d
|
349
|
+
E
|
350
|
+
EOR
|
351
|
+
merge_target = <<-EOM
|
352
|
+
a
|
353
|
+
b
|
354
|
+
C
|
355
|
+
d
|
356
|
+
e
|
357
|
+
EOM
|
358
|
+
expect = <<-EOE
|
359
|
+
A
|
360
|
+
b
|
361
|
+
C
|
362
|
+
d
|
363
|
+
E
|
364
|
+
EOE
|
365
|
+
|
366
|
+
left_label = "left"
|
367
|
+
right_label = "right"
|
368
|
+
merge_target_label = "merge_target"
|
369
|
+
|
370
|
+
left_file = "left"
|
371
|
+
right_file = "right"
|
372
|
+
merge_target_file = "merge_target"
|
373
|
+
left_path = File.join(@wc_path, left_file)
|
374
|
+
right_path = File.join(@wc_path, right_file)
|
375
|
+
merge_target_path = File.join(@wc_path, merge_target_file)
|
376
|
+
|
377
|
+
log = "sample log"
|
378
|
+
make_context(log) do |ctx|
|
379
|
+
|
380
|
+
File.open(left_path, "w") {|f| f.print(left)}
|
381
|
+
File.open(right_path, "w") {|f| f.print(right)}
|
382
|
+
File.open(merge_target_path, "w") {|f| f.print(merge_target)}
|
383
|
+
ctx.add(left_path)
|
384
|
+
ctx.add(right_path)
|
385
|
+
ctx.add(merge_target_path)
|
386
|
+
|
387
|
+
ctx.ci(@wc_path)
|
388
|
+
|
389
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
390
|
+
assert_equal(Svn::Wc::MERGE_MERGED,
|
391
|
+
access.merge(left_path, right_path, merge_target_path,
|
392
|
+
left_label, right_label, merge_target_label))
|
393
|
+
assert_equal(expect, File.read(merge_target_path))
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
def test_status
|
399
|
+
source = "source"
|
400
|
+
file1 = "file1"
|
401
|
+
file2 = "file2"
|
402
|
+
file3 = "file3"
|
403
|
+
file4 = "file4"
|
404
|
+
file5 = "file5"
|
405
|
+
path1 = File.join(@wc_path, file1)
|
406
|
+
path2 = File.join(@wc_path, file2)
|
407
|
+
path3 = File.join(@wc_path, file3)
|
408
|
+
path4 = File.join(@wc_path, file4)
|
409
|
+
path5 = File.join(@wc_path, file5)
|
410
|
+
log = "sample log"
|
411
|
+
make_context(log) do |ctx|
|
412
|
+
|
413
|
+
File.open(path1, "w") {|f| f.print(source)}
|
414
|
+
ctx.add(path1)
|
415
|
+
rev1 = ctx.ci(@wc_path).revision
|
416
|
+
|
417
|
+
ctx.cp(path1, path2)
|
418
|
+
rev2 = ctx.ci(@wc_path).revision
|
419
|
+
|
420
|
+
FileUtils.rm(path1)
|
421
|
+
|
422
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, false, 5) do |access|
|
423
|
+
status = access.status(path1)
|
424
|
+
assert_equal(Svn::Wc::STATUS_MISSING, status.text_status)
|
425
|
+
assert_equal(Svn::Wc::STATUS_MISSING, status.dup.text_status)
|
426
|
+
end
|
427
|
+
|
428
|
+
ctx.revert(path1)
|
429
|
+
|
430
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
431
|
+
access.copy(path1, file3)
|
432
|
+
assert(File.exist?(path3))
|
433
|
+
access.delete(path1)
|
434
|
+
assert(!File.exist?(path1))
|
435
|
+
FileUtils.touch(path4)
|
436
|
+
access.add(path4)
|
437
|
+
assert(File.exist?(path4))
|
438
|
+
access.add_repos_file2(path5, path2, {})
|
439
|
+
assert_equal(source, File.open(path5) {|f| f.read})
|
440
|
+
|
441
|
+
status = access.status(path2)
|
442
|
+
assert_equal(Svn::Wc::STATUS_MISSING, status.text_status)
|
443
|
+
access.remove_from_revision_control(file2)
|
444
|
+
status = access.status(path2)
|
445
|
+
assert_equal(Svn::Wc::STATUS_NONE, status.text_status)
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
def test_delete
|
451
|
+
source = "source"
|
452
|
+
file = "file"
|
453
|
+
path = File.join(@wc_path, file)
|
454
|
+
log = "sample log"
|
455
|
+
make_context(log) do |ctx|
|
456
|
+
|
457
|
+
File.open(path, "w") {|f| f.print(source)}
|
458
|
+
ctx.add(path)
|
459
|
+
ctx.ci(@wc_path).revision
|
460
|
+
|
461
|
+
assert(File.exists?(path))
|
462
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
463
|
+
access.delete(path)
|
464
|
+
end
|
465
|
+
assert(!File.exists?(path))
|
466
|
+
|
467
|
+
ctx.revert(path)
|
468
|
+
|
469
|
+
assert(File.exists?(path))
|
470
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
471
|
+
access.delete(path, nil, nil, true)
|
472
|
+
end
|
473
|
+
assert(File.exists?(path))
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
def test_locked
|
478
|
+
assert(!Svn::Wc.locked?(@wc_path))
|
479
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, -1) do |access|
|
480
|
+
assert(Svn::Wc.locked?(@wc_path))
|
481
|
+
end
|
482
|
+
assert(!Svn::Wc.locked?(@wc_path))
|
483
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, false, -1) do |access|
|
484
|
+
assert(!Svn::Wc.locked?(@wc_path))
|
485
|
+
end
|
486
|
+
assert(!Svn::Wc.locked?(@wc_path))
|
487
|
+
end
|
488
|
+
|
489
|
+
def assert_translated_eol(method_name)
|
490
|
+
src_file = "src"
|
491
|
+
crlf_file = "crlf"
|
492
|
+
cr_file = "cr"
|
493
|
+
lf_file = "lf"
|
494
|
+
src_path = File.join(@wc_path, src_file)
|
495
|
+
crlf_path = File.join(@wc_path, crlf_file)
|
496
|
+
cr_path = File.join(@wc_path, cr_file)
|
497
|
+
lf_path = File.join(@wc_path, lf_file)
|
498
|
+
|
499
|
+
source = "a\n"
|
500
|
+
crlf_source = source.gsub(/\n/, "\r\n")
|
501
|
+
cr_source = source.gsub(/\n/, "\r")
|
502
|
+
lf_source = source.gsub(/\n/, "\n")
|
503
|
+
|
504
|
+
File.open(crlf_path, "w") {}
|
505
|
+
File.open(cr_path, "w") {}
|
506
|
+
File.open(lf_path, "w") {}
|
507
|
+
|
508
|
+
log = "log"
|
509
|
+
make_context(log) do |ctx|
|
510
|
+
ctx.add(crlf_path)
|
511
|
+
ctx.add(cr_path)
|
512
|
+
ctx.add(lf_path)
|
513
|
+
ctx.prop_set("svn:eol-style", "CRLF", crlf_path)
|
514
|
+
ctx.prop_set("svn:eol-style", "CR", cr_path)
|
515
|
+
ctx.prop_set("svn:eol-style", "LF", lf_path)
|
516
|
+
ctx.ci(crlf_path)
|
517
|
+
ctx.ci(cr_path)
|
518
|
+
ctx.ci(lf_path)
|
519
|
+
|
520
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
521
|
+
_wrap_assertion do
|
522
|
+
File.open(src_path, "wb") {|f| f.print(source)}
|
523
|
+
args = [method_name, src_path, crlf_path, Svn::Wc::TRANSLATE_FROM_NF]
|
524
|
+
result = yield(access.send(*args), source)
|
525
|
+
result ||= File.open(src_path, "rb") {|f| f.read}
|
526
|
+
assert_equal(crlf_source, result)
|
527
|
+
|
528
|
+
File.open(src_path, "wb") {|f| f.print(source)}
|
529
|
+
args = [method_name, src_path, cr_path, Svn::Wc::TRANSLATE_FROM_NF]
|
530
|
+
result = yield(access.send(*args), source)
|
531
|
+
result ||= File.open(src_path, "rb") {|f| f.read}
|
532
|
+
assert_equal(cr_source, result)
|
533
|
+
|
534
|
+
File.open(src_path, "wb") {|f| f.print(source)}
|
535
|
+
args = [method_name, src_path, lf_path, Svn::Wc::TRANSLATE_FROM_NF]
|
536
|
+
result = yield(access.send(*args), source)
|
537
|
+
result ||= File.open(src_path, "rb") {|f| f.read}
|
538
|
+
assert_equal(lf_source, result)
|
539
|
+
end
|
540
|
+
end
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
def test_translated_file_eol
|
545
|
+
assert_translated_eol(:translated_file) do |name, source|
|
546
|
+
File.open(name, "rb") {|f| f.read}
|
547
|
+
end
|
548
|
+
end
|
549
|
+
|
550
|
+
def test_translated_file2_eol
|
551
|
+
assert_translated_eol(:translated_file2) do |file, source|
|
552
|
+
file.read
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
556
|
+
def test_translated_stream_eol
|
557
|
+
assert_translated_eol(:translated_stream) do |stream, source|
|
558
|
+
if source
|
559
|
+
stream.write(source)
|
560
|
+
stream.close
|
561
|
+
nil
|
562
|
+
else
|
563
|
+
stream.read
|
564
|
+
end
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
def assert_translated_keyword(method_name)
|
569
|
+
src_file = "$Revision$"
|
570
|
+
revision_file = "revision_file"
|
571
|
+
src_path = File.join(@wc_path, src_file)
|
572
|
+
revision_path = File.join(@wc_path, revision_file)
|
573
|
+
|
574
|
+
source = "$Revision$\n"
|
575
|
+
revision_source = source.gsub(/\$Revision\$/, "$Revision: 1 $")
|
576
|
+
|
577
|
+
File.open(revision_path, "w") {}
|
578
|
+
|
579
|
+
log = "log"
|
580
|
+
make_context(log) do |ctx|
|
581
|
+
ctx.add(revision_path)
|
582
|
+
ctx.prop_set("svn:keywords", "Revision", revision_path)
|
583
|
+
ctx.ci(revision_path)
|
584
|
+
|
585
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
|
586
|
+
File.open(src_path, "wb") {|f| f.print(source)}
|
587
|
+
args = [method_name, src_path, revision_path, Svn::Wc::TRANSLATE_FROM_NF]
|
588
|
+
result = yield(access.send(*args), source)
|
589
|
+
result ||= File.open(src_path, "rb") {|f| f.read}
|
590
|
+
assert_equal(revision_source, result)
|
591
|
+
|
592
|
+
File.open(src_path, "wb") {|f| f.print(source)}
|
593
|
+
args = [method_name, src_path, revision_path, Svn::Wc::TRANSLATE_TO_NF]
|
594
|
+
assert_equal(source, yield(access.send(*args)))
|
595
|
+
end
|
596
|
+
end
|
597
|
+
end
|
598
|
+
|
599
|
+
def test_translated_file_keyword
|
600
|
+
assert_translated_keyword(:translated_file) do |name, source|
|
601
|
+
File.open(name, "rb") {|f| f.read}
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
def test_translated_file2_keyword
|
606
|
+
assert_translated_keyword(:translated_file2) do |file, source|
|
607
|
+
file.read
|
608
|
+
end
|
609
|
+
end
|
610
|
+
|
611
|
+
def test_translated_stream_keyword
|
612
|
+
assert_translated_keyword(:translated_stream) do |stream, source|
|
613
|
+
if source
|
614
|
+
stream.write(source)
|
615
|
+
stream.close
|
616
|
+
nil
|
617
|
+
else
|
618
|
+
stream.read
|
619
|
+
end
|
620
|
+
end
|
621
|
+
end
|
622
|
+
|
623
|
+
def test_revision_status
|
624
|
+
log = "log"
|
625
|
+
file = "file"
|
626
|
+
path = File.join(@wc_path, file)
|
627
|
+
|
628
|
+
File.open(path, "w") {|f| f.print("a")}
|
629
|
+
make_context(log) do |ctx|
|
630
|
+
ctx.add(path)
|
631
|
+
ctx.ci(path)
|
632
|
+
|
633
|
+
File.open(path, "w") {|f| f.print("b")}
|
634
|
+
ctx.ci(path)
|
635
|
+
|
636
|
+
File.open(path, "w") {|f| f.print("c")}
|
637
|
+
rev = ctx.ci(path).revision
|
638
|
+
|
639
|
+
status = Svn::Wc::RevisionStatus.new(path, nil, true)
|
640
|
+
assert_equal(rev, status.min_rev)
|
641
|
+
assert_equal(rev, status.max_rev)
|
642
|
+
end
|
643
|
+
end
|
644
|
+
|
645
|
+
def test_external_item_new
|
646
|
+
assert_raises(NoMethodError) do
|
647
|
+
Svn::Wc::ExternalItem.new
|
648
|
+
end
|
649
|
+
|
650
|
+
item = Svn::Wc::ExternalItem2.new
|
651
|
+
assert_kind_of(Svn::Wc::ExternalItem2, item)
|
652
|
+
end
|
653
|
+
|
654
|
+
def test_external_item_dup
|
655
|
+
item = Svn::Wc::ExternalItem2.new
|
656
|
+
assert_kind_of(Svn::Wc::ExternalItem2, item)
|
657
|
+
|
658
|
+
item.target_dir = "xxx"
|
659
|
+
duped_item = item.dup
|
660
|
+
assert_equal(item.target_dir, duped_item.target_dir)
|
661
|
+
end
|
662
|
+
|
663
|
+
def test_committed_queue_new
|
664
|
+
queue = Svn::Wc::CommittedQueue.new
|
665
|
+
assert_kind_of(Svn::Wc::CommittedQueue, queue)
|
666
|
+
end
|
667
|
+
|
668
|
+
def assert_diff_callbacks(method_name)
|
669
|
+
log = "sample log"
|
670
|
+
file1 = "hello.txt"
|
671
|
+
file2 = "hello2.txt"
|
672
|
+
src = "Hello"
|
673
|
+
dir = "dir"
|
674
|
+
dir_path = File.join(@wc_path, dir)
|
675
|
+
path1 = File.join(dir_path, file1)
|
676
|
+
path2 = File.join(dir_path, file2)
|
677
|
+
prop_name = "my-prop"
|
678
|
+
prop_value = "value"
|
679
|
+
|
680
|
+
make_context(log) do |ctx|
|
681
|
+
config = {}
|
682
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
683
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
684
|
+
|
685
|
+
FileUtils.mkdir(dir_path)
|
686
|
+
File.open(path1, "w") {|f| f.print(src)}
|
687
|
+
ctx.add(dir_path)
|
688
|
+
rev1 = ctx.commit(@wc_path).revision
|
689
|
+
|
690
|
+
File.open(path1, "w") {|f| f.print(src * 2)}
|
691
|
+
File.open(path2, "w") {|f| f.print(src)}
|
692
|
+
ctx.add(path2)
|
693
|
+
ctx.prop_set(prop_name, prop_value, path1)
|
694
|
+
|
695
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |adm|
|
696
|
+
callbacks = Object.new
|
697
|
+
def callbacks.result
|
698
|
+
@result
|
699
|
+
end
|
700
|
+
def callbacks.result=(result)
|
701
|
+
@result = result
|
702
|
+
end
|
703
|
+
def callbacks.file_added(access, path, tmpfile1, tmpfile2, rev1,
|
704
|
+
rev2, mimetype1, mimetype2,
|
705
|
+
prop_changes, original_props)
|
706
|
+
@result << [:file_added, path, prop_changes]
|
707
|
+
[Svn::Wc::NOTIFY_STATE_UNCHANGED, Svn::Wc::NOTIFY_STATE_UNCHANGED]
|
708
|
+
end
|
709
|
+
def callbacks.file_changed(access, path, tmpfile1, tmpfile2, rev1,
|
710
|
+
rev2, mimetype1, mimetype2,
|
711
|
+
prop_changes, original_props)
|
712
|
+
@result << [:file_changed, path, prop_changes]
|
713
|
+
[Svn::Wc::NOTIFY_STATE_UNCHANGED, Svn::Wc::NOTIFY_STATE_UNCHANGED]
|
714
|
+
end
|
715
|
+
def callbacks.dir_props_changed(access, path, prop_changes, original_props)
|
716
|
+
@result << [:dir_props_changed, path, prop_changes]
|
717
|
+
Svn::Wc::NOTIFY_STATE_UNCHANGED
|
718
|
+
end
|
719
|
+
callbacks.result = []
|
720
|
+
editor = adm.__send__(method_name, dir, callbacks)
|
721
|
+
reporter = session.diff(rev1, "", @repos_uri, editor)
|
722
|
+
adm.crawl_revisions(dir_path, reporter)
|
723
|
+
|
724
|
+
property_info = {
|
725
|
+
:dir_changed_prop_names => [
|
726
|
+
"svn:entry:committed-date",
|
727
|
+
"svn:entry:uuid",
|
728
|
+
"svn:entry:last-author",
|
729
|
+
"svn:entry:committed-rev"
|
730
|
+
],
|
731
|
+
:file_changed_prop_name => prop_name,
|
732
|
+
:file_changed_prop_value => prop_value,
|
733
|
+
}
|
734
|
+
expected_props, actual_result = yield(property_info, callbacks.result)
|
735
|
+
dir_changed_props, file_changed_props, empty_changed_props = expected_props
|
736
|
+
assert_equal([
|
737
|
+
[:dir_props_changed, @wc_path, dir_changed_props],
|
738
|
+
[:file_changed, path1, file_changed_props],
|
739
|
+
[:file_added, path2, empty_changed_props],
|
740
|
+
],
|
741
|
+
callbacks.result)
|
742
|
+
end
|
743
|
+
end
|
744
|
+
end
|
745
|
+
end
|
746
|
+
|
747
|
+
def test_diff_callbacks_for_backward_compatibility
|
748
|
+
assert_diff_callbacks(:diff_editor) do |property_info, result|
|
749
|
+
dir_changed_prop_names = property_info[:dir_changed_prop_names]
|
750
|
+
dir_changed_props = dir_changed_prop_names.sort.collect do |name|
|
751
|
+
Svn::Core::Prop.new(name, nil)
|
752
|
+
end
|
753
|
+
prop_name = property_info[:file_changed_prop_name]
|
754
|
+
prop_value = property_info[:file_changed_prop_value]
|
755
|
+
file_changed_props = [Svn::Core::Prop.new(prop_name, prop_value)]
|
756
|
+
empty_changed_props = []
|
757
|
+
|
758
|
+
sorted_result = result.dup
|
759
|
+
dir_prop_changed = sorted_result.assoc(:dir_props_changed)
|
760
|
+
dir_prop_changed[2] = dir_prop_changed[2].sort_by {|prop| prop.name}
|
761
|
+
|
762
|
+
[[dir_changed_props, file_changed_props, empty_changed_props],
|
763
|
+
sorted_result]
|
764
|
+
end
|
765
|
+
end
|
766
|
+
|
767
|
+
def test_diff_callbacks
|
768
|
+
assert_diff_callbacks(:diff_editor2) do |property_info, result|
|
769
|
+
dir_changed_props = {}
|
770
|
+
property_info[:dir_changed_prop_names].each do |name|
|
771
|
+
dir_changed_props[name] = nil
|
772
|
+
end
|
773
|
+
prop_name = property_info[:file_changed_prop_name]
|
774
|
+
prop_value = property_info[:file_changed_prop_value]
|
775
|
+
file_changed_props = {prop_name => prop_value}
|
776
|
+
empty_changed_props = {}
|
777
|
+
[[dir_changed_props, file_changed_props, empty_changed_props],
|
778
|
+
result]
|
779
|
+
end
|
780
|
+
end
|
781
|
+
|
782
|
+
def test_update_editor
|
783
|
+
log = "sample log"
|
784
|
+
file1 = "hello.txt"
|
785
|
+
file2 = "hello2.txt"
|
786
|
+
src = "Hello"
|
787
|
+
dir = "dir"
|
788
|
+
dir_path = File.join(@wc_path, dir)
|
789
|
+
path1 = File.join(dir_path, file1)
|
790
|
+
path2 = File.join(dir_path, file2)
|
791
|
+
|
792
|
+
make_context(log) do |ctx|
|
793
|
+
config = {}
|
794
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
795
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
796
|
+
|
797
|
+
FileUtils.mkdir(dir_path)
|
798
|
+
File.open(path1, "w") {|f| f.print(src)}
|
799
|
+
ctx.add(dir_path)
|
800
|
+
rev1 = ctx.commit(@wc_path).revision
|
801
|
+
|
802
|
+
File.open(path1, "w") {|f| f.print(src * 2)}
|
803
|
+
File.open(path2, "w") {|f| f.print(src)}
|
804
|
+
ctx.add(path2)
|
805
|
+
rev2 = ctx.commit(@wc_path).revision
|
806
|
+
|
807
|
+
assert(File.exists?(path2))
|
808
|
+
assert_equal(0, ctx.up(@wc_path, 0))
|
809
|
+
assert(!File.exists?(path2))
|
810
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path) do |access|
|
811
|
+
editor = access.update_editor(@wc_path, 0)
|
812
|
+
assert_equal(0, editor.target_revision)
|
813
|
+
|
814
|
+
reporter = session.update2(rev2, "", editor)
|
815
|
+
access.crawl_revisions(@wc_path, reporter)
|
816
|
+
assert_equal(rev2, editor.target_revision)
|
817
|
+
end
|
818
|
+
end
|
819
|
+
end
|
820
|
+
end
|
821
|
+
|
822
|
+
def test_update_editor_options
|
823
|
+
log = "sample log"
|
824
|
+
file1 = "hello.txt"
|
825
|
+
file2 = "hello2.txt"
|
826
|
+
src = "Hello"
|
827
|
+
dir = "dir"
|
828
|
+
dir_path = File.join(@wc_path, dir)
|
829
|
+
path1 = File.join(dir_path, file1)
|
830
|
+
path2 = File.join(dir_path, file2)
|
831
|
+
|
832
|
+
make_context(log) do |ctx|
|
833
|
+
config = {}
|
834
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
835
|
+
Svn::Ra::Session.open(@repos_uri) do |session|
|
836
|
+
|
837
|
+
FileUtils.mkdir(dir_path)
|
838
|
+
File.open(path1, "w") {|f| f.print(src)}
|
839
|
+
ctx.add(dir_path)
|
840
|
+
rev1 = ctx.commit(@wc_path).revision
|
841
|
+
|
842
|
+
File.open(path1, "w") {|f| f.print(src * 2)}
|
843
|
+
File.open(path2, "w") {|f| f.print(src)}
|
844
|
+
ctx.add(path2)
|
845
|
+
rev2 = ctx.commit(@wc_path).revision
|
846
|
+
|
847
|
+
assert(File.exists?(path2))
|
848
|
+
assert_equal(0, ctx.up(@wc_path, 0))
|
849
|
+
assert(!File.exists?(path2))
|
850
|
+
notification_count = 0
|
851
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path) do |access|
|
852
|
+
notify_func = Proc.new {|n| notification_count += 1}
|
853
|
+
assert_raises(ArgumentError) do
|
854
|
+
access.update_editor2(:target_revision => 0,
|
855
|
+
:target => @wc_path,
|
856
|
+
:notify_fun => notify_func)
|
857
|
+
end
|
858
|
+
editor = access.update_editor(@wc_path, 0, true, nil, false, nil,
|
859
|
+
notify_func)
|
860
|
+
assert_equal(0, editor.target_revision)
|
861
|
+
|
862
|
+
reporter = session.update2(rev2, "", editor)
|
863
|
+
access.crawl_revisions(@wc_path, reporter)
|
864
|
+
assert_equal(rev2, editor.target_revision)
|
865
|
+
end
|
866
|
+
assert_equal(4, notification_count, "wrong number of notifications")
|
867
|
+
end
|
868
|
+
end
|
869
|
+
end
|
870
|
+
|
871
|
+
def test_update_editor2_conflict_func
|
872
|
+
log = "sample log"
|
873
|
+
source1 = "source"
|
874
|
+
source2 = "SOURCE"
|
875
|
+
source3 = "SHOYU"
|
876
|
+
file = "file"
|
877
|
+
path = File.join(@wc_path, file)
|
878
|
+
make_context(log) do |ctx|
|
879
|
+
|
880
|
+
File.open(path, "w") {|f| f.print(source1)}
|
881
|
+
ctx.add(path)
|
882
|
+
rev1 = ctx.ci(@wc_path).revision
|
883
|
+
|
884
|
+
File.open(path, "w") {|f| f.print(source2)}
|
885
|
+
rev2 = ctx.ci(@wc_path).revision
|
886
|
+
|
887
|
+
ctx.up(@wc_path, rev1)
|
888
|
+
File.open(path, "w") {|f| f.print(source3)}
|
889
|
+
|
890
|
+
Svn::Ra::Session.open(@repos_uri) do |session|
|
891
|
+
|
892
|
+
conflicted_paths = {}
|
893
|
+
|
894
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path) do |access|
|
895
|
+
editor = access.update_editor2(
|
896
|
+
:target => @wc_path,
|
897
|
+
:conflict_func => lambda{|n|
|
898
|
+
conflicted_paths[n.path]=true
|
899
|
+
Svn::Wc::CONFLICT_CHOOSE_MERGED
|
900
|
+
},
|
901
|
+
:target_revision => 0
|
902
|
+
)
|
903
|
+
|
904
|
+
assert_equal(0, editor.target_revision)
|
905
|
+
|
906
|
+
reporter = session.update2(rev2, "", editor)
|
907
|
+
access.crawl_revisions(@wc_path, reporter)
|
908
|
+
assert_equal(rev2, editor.target_revision)
|
909
|
+
end
|
910
|
+
|
911
|
+
assert_equal([path], conflicted_paths.keys);
|
912
|
+
end
|
913
|
+
end
|
914
|
+
end
|
915
|
+
|
916
|
+
def test_switch_editor
|
917
|
+
log = "sample log"
|
918
|
+
file1 = "hello.txt"
|
919
|
+
file2 = "hello2.txt"
|
920
|
+
src = "Hello"
|
921
|
+
dir1 = "dir1"
|
922
|
+
dir2 = "dir2"
|
923
|
+
dir1_path = File.join(@wc_path, dir1)
|
924
|
+
dir2_path = File.join(@wc_path, dir2)
|
925
|
+
dir1_uri = "#{@repos_uri}/#{dir1}"
|
926
|
+
dir2_uri = "#{@repos_uri}/#{dir2}"
|
927
|
+
path1 = File.join(dir1_path, file1)
|
928
|
+
path2 = File.join(dir2_path, file2)
|
929
|
+
|
930
|
+
make_context(log) do |ctx|
|
931
|
+
config = {}
|
932
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
933
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
934
|
+
|
935
|
+
FileUtils.mkdir(dir1_path)
|
936
|
+
File.open(path1, "w") {|f| f.print(src)}
|
937
|
+
ctx.add(dir1_path)
|
938
|
+
rev1 = ctx.commit(@wc_path).revision
|
939
|
+
|
940
|
+
FileUtils.mkdir(dir2_path)
|
941
|
+
File.open(path2, "w") {|f| f.print(src)}
|
942
|
+
ctx.add(dir2_path)
|
943
|
+
rev2 = ctx.commit(@wc_path).revision
|
944
|
+
|
945
|
+
assert(File.exists?(path1))
|
946
|
+
assert_equal(rev2, ctx.switch(@wc_path, dir2_uri))
|
947
|
+
assert(File.exists?(File.join(@wc_path, file2)))
|
948
|
+
Svn::Wc::AdmAccess.open_anchor(@wc_path) do |access, dir_access, target|
|
949
|
+
editor = dir_access.switch_editor(@wc_path, dir1_uri, rev2)
|
950
|
+
assert_equal(rev2, editor.target_revision)
|
951
|
+
|
952
|
+
reporter = session.switch2(rev1, dir1, dir1_uri, editor)
|
953
|
+
dir_access.crawl_revisions(@wc_path, reporter)
|
954
|
+
assert_equal(rev1, editor.target_revision)
|
955
|
+
end
|
956
|
+
end
|
957
|
+
end
|
958
|
+
end
|
959
|
+
|
960
|
+
def test_relocate
|
961
|
+
log = "sample log"
|
962
|
+
file1 = "hello.txt"
|
963
|
+
file2 = "hello2.txt"
|
964
|
+
src = "Hello"
|
965
|
+
dir1 = "dir1"
|
966
|
+
dir2 = "dir2"
|
967
|
+
dir1_path = File.join(@wc_path, dir1)
|
968
|
+
dir2_path = File.join(@wc_path, dir2)
|
969
|
+
dir1_uri = "#{@repos_uri}/#{dir1}"
|
970
|
+
dir2_uri = "#{@repos_uri}/#{dir2}"
|
971
|
+
path1 = File.join(dir1_path, file1)
|
972
|
+
path2 = File.join(dir2_path, file2)
|
973
|
+
|
974
|
+
make_context(log) do |ctx|
|
975
|
+
config = {}
|
976
|
+
callbacks = Svn::Ra::Callbacks.new(ctx.auth_baton)
|
977
|
+
Svn::Ra::Session.open(@repos_uri, config, callbacks) do |session|
|
978
|
+
|
979
|
+
FileUtils.mkdir(dir1_path)
|
980
|
+
File.open(path1, "w") {|f| f.print(src)}
|
981
|
+
ctx.add(dir1_path)
|
982
|
+
rev1 = ctx.commit(@wc_path).revision
|
983
|
+
|
984
|
+
FileUtils.mkdir(dir2_path)
|
985
|
+
File.open(path2, "w") {|f| f.print(src)}
|
986
|
+
ctx.add(dir2_path)
|
987
|
+
rev2 = ctx.commit(@wc_path).revision
|
988
|
+
|
989
|
+
Svn::Wc::AdmAccess.probe_open(nil, @wc_path) do |access|
|
990
|
+
assert(@repos_uri, access.entry(@wc_path).url)
|
991
|
+
values = []
|
992
|
+
access.relocate(@wc_path, @repos_uri, dir2_uri) do |uuid, url, root_url|
|
993
|
+
values << [uuid, url, root_url]
|
994
|
+
end
|
995
|
+
assert_equal([
|
996
|
+
[@fs.uuid, dir2_uri, nil],
|
997
|
+
[@fs.uuid, dir2_uri, dir2_uri],
|
998
|
+
[@fs.uuid, "#{dir2_uri}/#{dir1}", nil],
|
999
|
+
[@fs.uuid, "#{dir2_uri}/#{dir1}", dir2_uri],
|
1000
|
+
[@fs.uuid, "#{dir2_uri}/#{dir1}/#{file1}", nil],
|
1001
|
+
[@fs.uuid, "#{dir2_uri}/#{dir1}/#{file1}", dir2_uri],
|
1002
|
+
[@fs.uuid, "#{dir2_uri}/#{dir2}", nil],
|
1003
|
+
[@fs.uuid, "#{dir2_uri}/#{dir2}", dir2_uri],
|
1004
|
+
[@fs.uuid, "#{dir2_uri}/#{dir2}/#{file2}", nil],
|
1005
|
+
[@fs.uuid, "#{dir2_uri}/#{dir2}/#{file2}", dir2_uri],
|
1006
|
+
],
|
1007
|
+
values)
|
1008
|
+
assert(dir2_uri, access.entry(@wc_path).url)
|
1009
|
+
end
|
1010
|
+
end
|
1011
|
+
end
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
def test_ignore?
|
1015
|
+
assert(!Svn::Wc.ignore?("xxx.c", []))
|
1016
|
+
assert(Svn::Wc.ignore?("xxx.c", ["*.c"]))
|
1017
|
+
assert(!Svn::Wc.ignore?("xxx.c", ["XXX.c"]))
|
1018
|
+
assert(Svn::Wc.ignore?("xxx.c", ["xxx.c"]))
|
1019
|
+
assert(!Svn::Wc.ignore?("xxx.c", ["*.H", "*.C"]))
|
1020
|
+
assert(Svn::Wc.ignore?("xxx.C", ["*.H", "*.C"]))
|
1021
|
+
end
|
1022
|
+
|
1023
|
+
def test_changelist
|
1024
|
+
log = "sample log"
|
1025
|
+
file = "hello.txt"
|
1026
|
+
src = "Hello"
|
1027
|
+
path = File.join(@wc_path, file)
|
1028
|
+
|
1029
|
+
make_context(log) do |ctx|
|
1030
|
+
File.open(path, "w") {|f| f.print(src)}
|
1031
|
+
ctx.add(path)
|
1032
|
+
rev1 = ctx.commit(@wc_path).revision
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path) do |access|
|
1036
|
+
assert_nil(access.entry(@wc_path).changelist)
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
notifies = []
|
1040
|
+
notify_collector = Proc.new {|notify| notifies << notify }
|
1041
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path) do |access|
|
1042
|
+
access.set_changelist(path, "123", nil, notify_collector)
|
1043
|
+
end
|
1044
|
+
assert_equal([[path, nil]],
|
1045
|
+
notifies.collect {|notify| [notify.path, notify.err]})
|
1046
|
+
|
1047
|
+
notifies = []
|
1048
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path) do |access|
|
1049
|
+
access.set_changelist(path, "456", nil, notify_collector)
|
1050
|
+
end
|
1051
|
+
assert_equal([[path, Svn::Error::WcChangelistMove],
|
1052
|
+
[path, NilClass]],
|
1053
|
+
notifies.collect {|notify| [notify.path, notify.err.class]})
|
1054
|
+
|
1055
|
+
notifies = []
|
1056
|
+
|
1057
|
+
assert_raises(Svn::Error::ClientIsDirectory) do
|
1058
|
+
Svn::Wc::AdmAccess.open(nil, @wc_path) do |access|
|
1059
|
+
access.set_changelist(@wc_path, "789", nil, notify_collector)
|
1060
|
+
end
|
1061
|
+
end
|
1062
|
+
end
|
1063
|
+
end
|