subversion 1.6.6-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/licenses/apr/LICENSE +341 -0
- data/licenses/apr/NOTICE +15 -0
- data/licenses/apr-util/LICENSE +443 -0
- data/licenses/apr-util/NOTICE +14 -0
- data/licenses/bdb/LICENSE +102 -0
- data/licenses/cyrus-sasl/COPYING +44 -0
- data/licenses/neon/COPYING.LIB +482 -0
- data/licenses/openssl/LICENSE +127 -0
- data/licenses/serf/LICENSE +201 -0
- data/licenses/svn/COPYING +57 -0
- data/licenses/zlib/README +125 -0
- data/ruby/ext/svn/ext/client.dll +0 -0
- data/ruby/ext/svn/ext/core.dll +0 -0
- data/ruby/ext/svn/ext/delta.dll +0 -0
- data/ruby/ext/svn/ext/fs.dll +0 -0
- data/ruby/ext/svn/ext/intl3_svn.dll +0 -0
- data/ruby/ext/svn/ext/libapr-1.dll +0 -0
- data/ruby/ext/svn/ext/libaprutil-1.dll +0 -0
- data/ruby/ext/svn/ext/libdb44.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_client-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_delta-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_diff-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_repos-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_subr-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_swig_ruby-1.dll +0 -0
- data/ruby/ext/svn/ext/libsvn_wc-1.dll +0 -0
- data/ruby/ext/svn/ext/ra.dll +0 -0
- data/ruby/ext/svn/ext/repos.dll +0 -0
- data/ruby/ext/svn/ext/wc.dll +0 -0
- data/ruby/lib/svn/client.rb +771 -0
- data/ruby/lib/svn/core.rb +817 -0
- data/ruby/lib/svn/delta.rb +503 -0
- data/ruby/lib/svn/error.rb +74 -0
- data/ruby/lib/svn/fs.rb +628 -0
- data/ruby/lib/svn/info.rb +321 -0
- data/ruby/lib/svn/ra.rb +353 -0
- data/ruby/lib/svn/repos.rb +472 -0
- data/ruby/lib/svn/util.rb +129 -0
- data/ruby/lib/svn/wc.rb +689 -0
- metadata +96 -0
@@ -0,0 +1,817 @@
|
|
1
|
+
require "English"
|
2
|
+
require "time"
|
3
|
+
require "stringio"
|
4
|
+
require "tempfile"
|
5
|
+
require "svn/util"
|
6
|
+
require "svn/error"
|
7
|
+
require "svn/ext/core"
|
8
|
+
|
9
|
+
class Time
|
10
|
+
MILLION = 1_000_000
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def from_apr_time(apr_time)
|
14
|
+
return apr_time if apr_time.is_a?(Time)
|
15
|
+
sec, usec = apr_time.divmod(MILLION)
|
16
|
+
Time.at(sec, usec)
|
17
|
+
end
|
18
|
+
|
19
|
+
def from_svn_format(str)
|
20
|
+
return nil if str.nil?
|
21
|
+
return str if str.is_a?(Time)
|
22
|
+
from_apr_time(Svn::Core.time_from_cstring(str))
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse_svn_format(str)
|
26
|
+
return str if str.is_a?(Time)
|
27
|
+
matched, result = Svn::Core.parse_date(str, Time.now.to_apr_time)
|
28
|
+
if matched
|
29
|
+
from_apr_time(result)
|
30
|
+
else
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_apr_time
|
37
|
+
to_i * MILLION + usec
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_svn_format
|
41
|
+
Svn::Core.time_to_cstring(self.to_apr_time)
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_svn_human_format
|
45
|
+
Svn::Core.time_to_human_cstring(self.to_apr_time)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
module Svn
|
50
|
+
module Core
|
51
|
+
Util.set_constants(Ext::Core, self)
|
52
|
+
Util.set_methods(Ext::Core, self)
|
53
|
+
|
54
|
+
nls_init
|
55
|
+
Util.reset_message_directory
|
56
|
+
|
57
|
+
# for backward compatibility
|
58
|
+
SWIG_INVALID_REVNUM = INVALID_REVNUM
|
59
|
+
SWIG_IGNORED_REVNUM = IGNORED_REVNUM
|
60
|
+
|
61
|
+
class << self
|
62
|
+
alias binary_mime_type? mime_type_is_binary
|
63
|
+
alias prop_diffs2 prop_diffs
|
64
|
+
|
65
|
+
def prop_diffs(target_props, source_props)
|
66
|
+
Property.prop_diffs(target_props, source_props)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
DEFAULT_CHARSET = default_charset
|
72
|
+
LOCALE_CHARSET = locale_charset
|
73
|
+
|
74
|
+
AuthCredSSLClientCert = AuthCredSslClientCert
|
75
|
+
AuthCredSSLClientCertPw = AuthCredSslClientCertPw
|
76
|
+
AuthCredSSLServerTrust = AuthCredSslServerTrust
|
77
|
+
|
78
|
+
dirent_all = 0
|
79
|
+
constants.each do |name|
|
80
|
+
dirent_all |= const_get(name) if /^DIRENT_/ =~ name
|
81
|
+
end
|
82
|
+
DIRENT_ALL = dirent_all
|
83
|
+
|
84
|
+
Pool = Svn::Ext::Core::Apr_pool_wrapper_t
|
85
|
+
|
86
|
+
class Pool
|
87
|
+
RECOMMENDED_MAX_FREE_SIZE = ALLOCATOR_RECOMMENDED_MAX_FREE
|
88
|
+
MAX_FREE_UNLIMITED = ALLOCATOR_MAX_FREE_UNLIMITED
|
89
|
+
|
90
|
+
class << self
|
91
|
+
def number_of_pools
|
92
|
+
ObjectSpace.each_object(Pool) {}
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
alias _initialize initialize
|
97
|
+
private :_initialize
|
98
|
+
def initialize(parent=nil)
|
99
|
+
_initialize(parent)
|
100
|
+
@parent = parent
|
101
|
+
end
|
102
|
+
|
103
|
+
def destroy
|
104
|
+
@parent = nil
|
105
|
+
_destroy
|
106
|
+
end
|
107
|
+
private :_destroy
|
108
|
+
end
|
109
|
+
|
110
|
+
class Stream
|
111
|
+
if Core.const_defined?(:STREAM_CHUNK_SIZE)
|
112
|
+
CHUNK_SIZE = Core::STREAM_CHUNK_SIZE
|
113
|
+
else
|
114
|
+
CHUNK_SIZE = 8192
|
115
|
+
end
|
116
|
+
|
117
|
+
def write(data)
|
118
|
+
Core.stream_write(self, data)
|
119
|
+
end
|
120
|
+
|
121
|
+
def read(len=nil)
|
122
|
+
if len.nil?
|
123
|
+
read_all
|
124
|
+
else
|
125
|
+
buf = ""
|
126
|
+
while len > CHUNK_SIZE
|
127
|
+
buf << _read(CHUNK_SIZE)
|
128
|
+
len -= CHUNK_SIZE
|
129
|
+
end
|
130
|
+
buf << _read(len)
|
131
|
+
buf
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def close
|
136
|
+
Core.stream_close(self)
|
137
|
+
end
|
138
|
+
|
139
|
+
def copy(other, &cancel_proc)
|
140
|
+
Core.stream_copy2(self, other, cancel_proc)
|
141
|
+
end
|
142
|
+
|
143
|
+
private
|
144
|
+
def _read(size)
|
145
|
+
Core.stream_read(self, size)
|
146
|
+
end
|
147
|
+
|
148
|
+
def read_all
|
149
|
+
buf = ""
|
150
|
+
while chunk = _read(CHUNK_SIZE)
|
151
|
+
buf << chunk
|
152
|
+
end
|
153
|
+
buf
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
class AuthBaton
|
159
|
+
attr_reader :providers, :parameters
|
160
|
+
|
161
|
+
alias _initialize initialize
|
162
|
+
private :_initialize
|
163
|
+
def initialize(providers=[], parameters={})
|
164
|
+
_initialize(providers)
|
165
|
+
@providers = providers
|
166
|
+
self.parameters = parameters
|
167
|
+
end
|
168
|
+
|
169
|
+
def [](name)
|
170
|
+
Core.auth_get_parameter(self, name)
|
171
|
+
end
|
172
|
+
|
173
|
+
def []=(name, value)
|
174
|
+
Core.auth_set_parameter(self, name, value)
|
175
|
+
@parameters[name] = value
|
176
|
+
end
|
177
|
+
|
178
|
+
def parameters=(params)
|
179
|
+
@parameters = {}
|
180
|
+
params.each do |key, value|
|
181
|
+
self[key] = value
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
module Authenticatable
|
187
|
+
attr_accessor :auth_baton
|
188
|
+
|
189
|
+
def add_simple_provider
|
190
|
+
add_provider(Core.auth_get_simple_provider)
|
191
|
+
end
|
192
|
+
|
193
|
+
if Core.respond_to?(:auth_get_windows_simple_provider)
|
194
|
+
def add_windows_simple_provider
|
195
|
+
add_provider(Core.auth_get_windows_simple_provider)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
if Core.respond_to?(:auth_get_keychain_simple_provider)
|
200
|
+
def add_keychain_simple_provider
|
201
|
+
add_provider(Core.auth_get_keychain_simple_provider)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def add_username_provider
|
206
|
+
add_provider(Core.auth_get_username_provider)
|
207
|
+
end
|
208
|
+
|
209
|
+
def add_ssl_client_cert_file_provider
|
210
|
+
add_provider(Core.auth_get_ssl_client_cert_file_provider)
|
211
|
+
end
|
212
|
+
|
213
|
+
def add_ssl_client_cert_pw_file_provider
|
214
|
+
add_provider(Core.auth_get_ssl_client_cert_pw_file_provider)
|
215
|
+
end
|
216
|
+
|
217
|
+
def add_ssl_server_trust_file_provider
|
218
|
+
add_provider(Core.auth_get_ssl_server_trust_file_provider)
|
219
|
+
end
|
220
|
+
|
221
|
+
if Core.respond_to?(:auth_get_windows_ssl_server_trust_provider)
|
222
|
+
def add_windows_ssl_server_trust_provider
|
223
|
+
add_provider(Core.auth_get_windows_ssl_server_trust_provider)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def add_simple_prompt_provider(retry_limit, prompt=Proc.new)
|
228
|
+
args = [retry_limit]
|
229
|
+
klass = AuthCredSimple
|
230
|
+
add_prompt_provider("simple", args, prompt, klass)
|
231
|
+
end
|
232
|
+
|
233
|
+
def add_username_prompt_provider(retry_limit, prompt=Proc.new)
|
234
|
+
args = [retry_limit]
|
235
|
+
klass = AuthCredUsername
|
236
|
+
add_prompt_provider("username", args, prompt, klass)
|
237
|
+
end
|
238
|
+
|
239
|
+
def add_ssl_server_trust_prompt_provider(prompt=Proc.new)
|
240
|
+
args = []
|
241
|
+
klass = AuthCredSSLServerTrust
|
242
|
+
add_prompt_provider("ssl_server_trust", args, prompt, klass)
|
243
|
+
end
|
244
|
+
|
245
|
+
def add_ssl_client_cert_prompt_provider(retry_limit, prompt=Proc.new)
|
246
|
+
args = [retry_limit]
|
247
|
+
klass = AuthCredSSLClientCert
|
248
|
+
add_prompt_provider("ssl_client_cert", args, prompt, klass)
|
249
|
+
end
|
250
|
+
|
251
|
+
def add_ssl_client_cert_pw_prompt_provider(retry_limit, prompt=Proc.new)
|
252
|
+
args = [retry_limit]
|
253
|
+
klass = AuthCredSSLClientCertPw
|
254
|
+
add_prompt_provider("ssl_client_cert_pw", args, prompt, klass)
|
255
|
+
end
|
256
|
+
|
257
|
+
private
|
258
|
+
def add_prompt_provider(name, args, prompt, credential_class)
|
259
|
+
real_prompt = Proc.new do |*prompt_args|
|
260
|
+
credential = credential_class.new
|
261
|
+
prompt.call(credential, *prompt_args)
|
262
|
+
credential
|
263
|
+
end
|
264
|
+
method_name = "swig_rb_auth_get_#{name}_prompt_provider"
|
265
|
+
baton, provider = Core.send(method_name, real_prompt, *args)
|
266
|
+
provider.instance_variable_set("@baton", baton)
|
267
|
+
provider.instance_variable_set("@prompt", real_prompt)
|
268
|
+
add_provider(provider)
|
269
|
+
end
|
270
|
+
|
271
|
+
def add_provider(provider)
|
272
|
+
if auth_baton
|
273
|
+
providers = auth_baton.providers
|
274
|
+
parameters = auth_baton.parameters
|
275
|
+
else
|
276
|
+
providers = []
|
277
|
+
parameters = {}
|
278
|
+
end
|
279
|
+
self.auth_baton = AuthBaton.new(providers + [provider], parameters)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
class AuthProviderObject
|
284
|
+
class << self
|
285
|
+
undef new
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
|
290
|
+
Diff = SWIG::TYPE_p_svn_diff_t
|
291
|
+
class Diff
|
292
|
+
attr_accessor :original, :modified, :latest, :ancestor
|
293
|
+
|
294
|
+
class << self
|
295
|
+
def version
|
296
|
+
Core.diff_version
|
297
|
+
end
|
298
|
+
|
299
|
+
def file_diff(original, modified, options=nil)
|
300
|
+
options ||= Core::DiffFileOptions.new
|
301
|
+
diff = Core.diff_file_diff_2(original, modified, options)
|
302
|
+
if diff
|
303
|
+
diff.original = original
|
304
|
+
diff.modified = modified
|
305
|
+
end
|
306
|
+
diff
|
307
|
+
end
|
308
|
+
|
309
|
+
def file_diff3(original, modified, latest, options=nil)
|
310
|
+
options ||= Core::DiffFileOptions.new
|
311
|
+
diff = Core.diff_file_diff3_2(original, modified, latest, options)
|
312
|
+
if diff
|
313
|
+
diff.original = original
|
314
|
+
diff.modified = modified
|
315
|
+
diff.latest = latest
|
316
|
+
end
|
317
|
+
diff
|
318
|
+
end
|
319
|
+
|
320
|
+
def file_diff4(original, modified, latest, ancestor, options=nil)
|
321
|
+
options ||= Core::DiffFileOptions.new
|
322
|
+
args = [original, modified, latest, ancestor, options]
|
323
|
+
diff = Core.diff_file_diff4_2(*args)
|
324
|
+
if diff
|
325
|
+
diff.original = original
|
326
|
+
diff.modified = modified
|
327
|
+
diff.latest = latest
|
328
|
+
diff.ancestor = ancestor
|
329
|
+
end
|
330
|
+
diff
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
def unified(orig_label, mod_label, header_encoding=nil)
|
335
|
+
header_encoding ||= Svn::Core.locale_charset
|
336
|
+
output = StringIO.new
|
337
|
+
args = [
|
338
|
+
output, self, @original, @modified,
|
339
|
+
orig_label, mod_label, header_encoding
|
340
|
+
]
|
341
|
+
Core.diff_file_output_unified2(*args)
|
342
|
+
output.rewind
|
343
|
+
output.read
|
344
|
+
end
|
345
|
+
|
346
|
+
def merge(conflict_original=nil, conflict_modified=nil,
|
347
|
+
conflict_latest=nil, conflict_separator=nil,
|
348
|
+
display_original_in_conflict=true,
|
349
|
+
display_resolved_conflicts=true)
|
350
|
+
header_encoding ||= Svn::Core.locale_charset
|
351
|
+
output = StringIO.new
|
352
|
+
args = [
|
353
|
+
output, self, @original, @modified, @latest,
|
354
|
+
conflict_original, conflict_modified,
|
355
|
+
conflict_latest, conflict_separator,
|
356
|
+
display_original_in_conflict,
|
357
|
+
display_resolved_conflicts,
|
358
|
+
]
|
359
|
+
Core.diff_file_output_merge(*args)
|
360
|
+
output.rewind
|
361
|
+
output.read
|
362
|
+
end
|
363
|
+
|
364
|
+
def conflict?
|
365
|
+
Core.diff_contains_conflicts(self)
|
366
|
+
end
|
367
|
+
|
368
|
+
def diff?
|
369
|
+
Core.diff_contains_diffs(self)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
class DiffFileOptions
|
374
|
+
class << self
|
375
|
+
def parse(*args)
|
376
|
+
options = new
|
377
|
+
options.parse(*args)
|
378
|
+
options
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
def parse(*args)
|
383
|
+
args = args.first if args.size == 1 and args.first.is_a?(Array)
|
384
|
+
Svn::Core.diff_file_options_parse(self, args)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
class Version
|
389
|
+
|
390
|
+
alias _initialize initialize
|
391
|
+
def initialize(major=nil, minor=nil, patch=nil, tag=nil)
|
392
|
+
_initialize
|
393
|
+
self.major = major if major
|
394
|
+
self.minor = minor if minor
|
395
|
+
self.patch = patch if patch
|
396
|
+
self.tag = tag || ""
|
397
|
+
end
|
398
|
+
|
399
|
+
def ==(other)
|
400
|
+
valid? and other.valid? and Core.ver_equal(self, other)
|
401
|
+
end
|
402
|
+
|
403
|
+
def compatible?(other)
|
404
|
+
valid? and other.valid? and Core.ver_compatible(self, other)
|
405
|
+
end
|
406
|
+
|
407
|
+
def valid?
|
408
|
+
(major and minor and patch and tag) ? true : false
|
409
|
+
end
|
410
|
+
|
411
|
+
alias _tag= tag=
|
412
|
+
def tag=(value)
|
413
|
+
@tag = value
|
414
|
+
self._tag = value
|
415
|
+
end
|
416
|
+
|
417
|
+
def to_a
|
418
|
+
[major, minor, patch, tag]
|
419
|
+
end
|
420
|
+
|
421
|
+
def to_s
|
422
|
+
"#{major}.#{minor}.#{patch}#{tag}"
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
# Following methods are also available:
|
427
|
+
#
|
428
|
+
# [created_rev]
|
429
|
+
# Returns a revision at which the instance was last modified.
|
430
|
+
# [have_props?]
|
431
|
+
# Returns +true+ if the instance has properties.
|
432
|
+
# [last_author]
|
433
|
+
# Returns an author who last modified the instance.
|
434
|
+
# [size]
|
435
|
+
# Returns a size of the instance.
|
436
|
+
class Dirent
|
437
|
+
alias have_props? has_props
|
438
|
+
|
439
|
+
# Returns +true+ when the instance is none.
|
440
|
+
def none?
|
441
|
+
kind == NODE_NONE
|
442
|
+
end
|
443
|
+
|
444
|
+
# Returns +true+ when the instance is a directory.
|
445
|
+
def directory?
|
446
|
+
kind == NODE_DIR
|
447
|
+
end
|
448
|
+
|
449
|
+
# Returns +true+ when the instance is a file.
|
450
|
+
def file?
|
451
|
+
kind == NODE_FILE
|
452
|
+
end
|
453
|
+
|
454
|
+
# Returns +true+ when the instance is an unknown node.
|
455
|
+
def unknown?
|
456
|
+
kind == NODE_UNKNOWN
|
457
|
+
end
|
458
|
+
|
459
|
+
# Returns a Time when the instance was last changed.
|
460
|
+
#
|
461
|
+
# Svn::Core::Dirent#time is replaced by this method, _deprecated_,
|
462
|
+
# and provided for backward compatibility with the 1.3 API.
|
463
|
+
def time2
|
464
|
+
__time = time
|
465
|
+
__time && Time.from_apr_time(__time)
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
Config = SWIG::TYPE_p_svn_config_t
|
470
|
+
|
471
|
+
class Config
|
472
|
+
include Enumerable
|
473
|
+
|
474
|
+
class << self
|
475
|
+
def get(path=nil)
|
476
|
+
Core.config_get_config(path)
|
477
|
+
end
|
478
|
+
alias config get
|
479
|
+
|
480
|
+
def read(file, must_exist=true)
|
481
|
+
Core.config_read(file, must_exist)
|
482
|
+
end
|
483
|
+
|
484
|
+
def ensure(dir)
|
485
|
+
Core.config_ensure(dir)
|
486
|
+
end
|
487
|
+
|
488
|
+
def read_auth_data(cred_kind, realm_string, config_dir=nil)
|
489
|
+
Core.config_read_auth_data(cred_kind, realm_string, config_dir)
|
490
|
+
end
|
491
|
+
|
492
|
+
def write_auth_data(hash, cred_kind, realm_string, config_dir=nil)
|
493
|
+
Core.config_write_auth_data(hash, cred_kind,
|
494
|
+
realm_string, config_dir)
|
495
|
+
end
|
496
|
+
end
|
497
|
+
|
498
|
+
def merge(file, must_exist=true)
|
499
|
+
Core.config_merge(self, file, must_exist)
|
500
|
+
end
|
501
|
+
|
502
|
+
def get(section, option, default=nil)
|
503
|
+
Core.config_get(self, section, option, default)
|
504
|
+
end
|
505
|
+
|
506
|
+
def get_bool(section, option, default)
|
507
|
+
Core.config_get_bool(self, section, option, default)
|
508
|
+
end
|
509
|
+
|
510
|
+
def set(section, option, value)
|
511
|
+
Core.config_set(self, section, option, value)
|
512
|
+
end
|
513
|
+
alias_method :[]=, :set
|
514
|
+
|
515
|
+
def set_bool(section, option, value)
|
516
|
+
Core.config_set_bool(self, section, option, value)
|
517
|
+
end
|
518
|
+
|
519
|
+
def each
|
520
|
+
each_section do |section|
|
521
|
+
each_option(section) do |name, value|
|
522
|
+
yield(section, name, value)
|
523
|
+
true
|
524
|
+
end
|
525
|
+
true
|
526
|
+
end
|
527
|
+
end
|
528
|
+
|
529
|
+
def each_option(section)
|
530
|
+
receiver = Proc.new do |name, value|
|
531
|
+
yield(name, value)
|
532
|
+
end
|
533
|
+
Core.config_enumerate2(self, section, receiver)
|
534
|
+
end
|
535
|
+
|
536
|
+
def each_section
|
537
|
+
receiver = Proc.new do |name|
|
538
|
+
yield(name)
|
539
|
+
end
|
540
|
+
Core.config_enumerate_sections2(self, receiver)
|
541
|
+
end
|
542
|
+
|
543
|
+
def find_group(key, section)
|
544
|
+
Core.config_find_group(self, key, section)
|
545
|
+
end
|
546
|
+
|
547
|
+
def get_server_setting(group, name, default=nil)
|
548
|
+
Core.config_get_server_setting(self, group, name, default)
|
549
|
+
end
|
550
|
+
|
551
|
+
def get_server_setting_int(group, name, default)
|
552
|
+
Core.config_get_server_setting_int(self, group, name, default)
|
553
|
+
end
|
554
|
+
|
555
|
+
alias_method :_to_s, :to_s
|
556
|
+
def to_s
|
557
|
+
result = ""
|
558
|
+
each_section do |section|
|
559
|
+
result << "[#{section}]\n"
|
560
|
+
each_option(section) do |name, value|
|
561
|
+
result << "#{name} = #{value}\n"
|
562
|
+
end
|
563
|
+
result << "\n"
|
564
|
+
end
|
565
|
+
result
|
566
|
+
end
|
567
|
+
|
568
|
+
def inspect
|
569
|
+
"#{_to_s}#{to_hash.inspect}"
|
570
|
+
end
|
571
|
+
|
572
|
+
def to_hash
|
573
|
+
sections = {}
|
574
|
+
each do |section, name, value|
|
575
|
+
sections[section] ||= {}
|
576
|
+
sections[section][name] = value
|
577
|
+
end
|
578
|
+
sections
|
579
|
+
end
|
580
|
+
|
581
|
+
def ==(other)
|
582
|
+
other.is_a?(self.class) and to_hash == other.to_hash
|
583
|
+
end
|
584
|
+
end
|
585
|
+
|
586
|
+
module Property
|
587
|
+
module_function
|
588
|
+
def kind(name)
|
589
|
+
kind, len = Core.property_kind(name)
|
590
|
+
[kind, name[0...len]]
|
591
|
+
end
|
592
|
+
|
593
|
+
def svn_prop?(name)
|
594
|
+
Core.prop_is_svn_prop(name)
|
595
|
+
end
|
596
|
+
|
597
|
+
def needs_translation?(name)
|
598
|
+
Core.prop_needs_translation(name)
|
599
|
+
end
|
600
|
+
|
601
|
+
def categorize(props)
|
602
|
+
categorize2(props).collect do |categorized_props|
|
603
|
+
Util.hash_to_prop_array(categorized_props)
|
604
|
+
end
|
605
|
+
end
|
606
|
+
alias_method :categorize_props, :categorize
|
607
|
+
module_function :categorize_props
|
608
|
+
|
609
|
+
def categorize2(props)
|
610
|
+
Core.categorize_props(props)
|
611
|
+
end
|
612
|
+
|
613
|
+
def diffs(target_props, source_props)
|
614
|
+
Util.hash_to_prop_array(diffs2(target_props, source_props))
|
615
|
+
end
|
616
|
+
alias_method :prop_diffs, :diffs
|
617
|
+
module_function :prop_diffs
|
618
|
+
|
619
|
+
def diffs2(target_props, source_props)
|
620
|
+
Core.prop_diffs2(target_props, source_props)
|
621
|
+
end
|
622
|
+
|
623
|
+
def has_svn_prop?(props)
|
624
|
+
Core.prop_has_svn_prop(props)
|
625
|
+
end
|
626
|
+
alias_method :have_svn_prop?, :has_svn_prop?
|
627
|
+
module_function :have_svn_prop?
|
628
|
+
|
629
|
+
def valid_name?(name)
|
630
|
+
Core.prop_name_is_valid(name)
|
631
|
+
end
|
632
|
+
end
|
633
|
+
|
634
|
+
module Depth
|
635
|
+
module_function
|
636
|
+
def from_string(str)
|
637
|
+
return nil if str.nil?
|
638
|
+
Core.depth_from_word(str)
|
639
|
+
end
|
640
|
+
|
641
|
+
def to_string(depth)
|
642
|
+
Core.depth_to_word(depth)
|
643
|
+
end
|
644
|
+
|
645
|
+
def infinity_or_empty_from_recurse(depth_or_recurse)
|
646
|
+
case depth_or_recurse
|
647
|
+
when true : DEPTH_INFINITY
|
648
|
+
when false : DEPTH_EMPTY
|
649
|
+
else depth_or_recurse
|
650
|
+
end
|
651
|
+
end
|
652
|
+
|
653
|
+
def infinity_or_immediates_from_recurse(depth_or_recurse)
|
654
|
+
case depth_or_recurse
|
655
|
+
when true : DEPTH_INFINITY
|
656
|
+
when false : DEPTH_IMMEDIATES
|
657
|
+
else depth_or_recurse
|
658
|
+
end
|
659
|
+
end
|
660
|
+
end
|
661
|
+
|
662
|
+
module MimeType
|
663
|
+
module_function
|
664
|
+
def parse(source)
|
665
|
+
file = Tempfile.new("svn-ruby-mime-type")
|
666
|
+
file.print(source)
|
667
|
+
file.close
|
668
|
+
Core.io_parse_mimetypes_file(file.path)
|
669
|
+
end
|
670
|
+
|
671
|
+
def parse_file(path)
|
672
|
+
Core.io_parse_mimetypes_file(path)
|
673
|
+
end
|
674
|
+
|
675
|
+
def detect(path, type_map={})
|
676
|
+
Core.io_detect_mimetype2(path, type_map)
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
class CommitInfo
|
681
|
+
alias _date date
|
682
|
+
def date
|
683
|
+
Time.from_svn_format(_date)
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
# Following methods are also available:
|
688
|
+
#
|
689
|
+
# [action]
|
690
|
+
# Returns an action taken to the path at the revision.
|
691
|
+
# [copyfrom_path]
|
692
|
+
# If the path was added at the revision by the copy action from
|
693
|
+
# another path at another revision, returns an original path.
|
694
|
+
# Otherwise, returns +nil+.
|
695
|
+
# [copyfrom_rev]
|
696
|
+
# If the path was added at the revision by the copy action from
|
697
|
+
# another path at another revision, returns an original revision.
|
698
|
+
# Otherwise, returns <tt>-1</tt>.
|
699
|
+
class LogChangedPath
|
700
|
+
# Returns +true+ when the path is added by the copy action.
|
701
|
+
def copied?
|
702
|
+
Util.copy?(copyfrom_path, copyfrom_rev)
|
703
|
+
end
|
704
|
+
end
|
705
|
+
|
706
|
+
# For backward compatibility
|
707
|
+
class Prop
|
708
|
+
attr_accessor :name, :value
|
709
|
+
def initialize(name, value)
|
710
|
+
@name = name
|
711
|
+
@value = value
|
712
|
+
end
|
713
|
+
|
714
|
+
def ==(other)
|
715
|
+
other.is_a?(self.class) and
|
716
|
+
[@name, @value] == [other.name, other.value]
|
717
|
+
end
|
718
|
+
end
|
719
|
+
|
720
|
+
class MergeRange
|
721
|
+
def to_a
|
722
|
+
[self.start, self.end, self.inheritable]
|
723
|
+
end
|
724
|
+
|
725
|
+
def inspect
|
726
|
+
super.gsub(/>$/, ":#{to_a.inspect}>")
|
727
|
+
end
|
728
|
+
|
729
|
+
def ==(other)
|
730
|
+
to_a == other.to_a
|
731
|
+
end
|
732
|
+
end
|
733
|
+
|
734
|
+
class MergeInfo < Hash
|
735
|
+
class << self
|
736
|
+
def parse(input)
|
737
|
+
new(Core.mergeinfo_parse(input))
|
738
|
+
end
|
739
|
+
end
|
740
|
+
|
741
|
+
def initialize(info)
|
742
|
+
super()
|
743
|
+
info.each do |path, ranges|
|
744
|
+
self[path] = RangeList.new(*ranges)
|
745
|
+
end
|
746
|
+
end
|
747
|
+
|
748
|
+
def diff(to, consider_inheritance=false)
|
749
|
+
Core.mergeinfo_diff(self, to, consider_inheritance).collect do |result|
|
750
|
+
self.class.new(result)
|
751
|
+
end
|
752
|
+
end
|
753
|
+
|
754
|
+
def merge(changes)
|
755
|
+
self.class.new(Core.swig_mergeinfo_merge(self, changes))
|
756
|
+
end
|
757
|
+
|
758
|
+
def remove(eraser)
|
759
|
+
self.class.new(Core.mergeinfo_remove(eraser, self))
|
760
|
+
end
|
761
|
+
|
762
|
+
def sort
|
763
|
+
self.class.new(Core.swig_mergeinfo_sort(self))
|
764
|
+
end
|
765
|
+
|
766
|
+
def to_s
|
767
|
+
Core.mergeinfo_to_string(self)
|
768
|
+
end
|
769
|
+
end
|
770
|
+
|
771
|
+
class RangeList < Array
|
772
|
+
def initialize(*ranges)
|
773
|
+
super()
|
774
|
+
ranges.each do |range|
|
775
|
+
self << Svn::Core::MergeRange.new(*range.to_a)
|
776
|
+
end
|
777
|
+
end
|
778
|
+
|
779
|
+
def diff(to, consider_inheritance=false)
|
780
|
+
result = Core.rangelist_diff(self, to, consider_inheritance)
|
781
|
+
deleted = result.pop
|
782
|
+
added = result
|
783
|
+
[added, deleted].collect do |result|
|
784
|
+
self.class.new(*result)
|
785
|
+
end
|
786
|
+
end
|
787
|
+
|
788
|
+
def merge(changes)
|
789
|
+
self.class.new(*Core.swig_rangelist_merge(self, changes))
|
790
|
+
end
|
791
|
+
|
792
|
+
def remove(eraser, consider_inheritance=false)
|
793
|
+
self.class.new(*Core.rangelist_remove(eraser, self,
|
794
|
+
consider_inheritance))
|
795
|
+
end
|
796
|
+
|
797
|
+
def intersect(other, consider_inheritance=false)
|
798
|
+
self.class.new(*Core.rangelist_intersect(self, other,
|
799
|
+
consider_inheritance))
|
800
|
+
end
|
801
|
+
|
802
|
+
def reverse
|
803
|
+
self.class.new(*Core.swig_rangelist_reverse(self))
|
804
|
+
end
|
805
|
+
|
806
|
+
def to_s
|
807
|
+
Core.rangelist_to_string(self)
|
808
|
+
end
|
809
|
+
end
|
810
|
+
|
811
|
+
class LogEntry
|
812
|
+
alias_method(:revision_properties, :revprops)
|
813
|
+
alias_method(:has_children?, :has_children)
|
814
|
+
undef_method(:has_children)
|
815
|
+
end
|
816
|
+
end
|
817
|
+
end
|