subversion 1.6.6-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.
Files changed (42) hide show
  1. data/licenses/apr/LICENSE +341 -0
  2. data/licenses/apr/NOTICE +15 -0
  3. data/licenses/apr-util/LICENSE +443 -0
  4. data/licenses/apr-util/NOTICE +14 -0
  5. data/licenses/bdb/LICENSE +102 -0
  6. data/licenses/cyrus-sasl/COPYING +44 -0
  7. data/licenses/neon/COPYING.LIB +482 -0
  8. data/licenses/openssl/LICENSE +127 -0
  9. data/licenses/serf/LICENSE +201 -0
  10. data/licenses/svn/COPYING +57 -0
  11. data/licenses/zlib/README +125 -0
  12. data/ruby/ext/svn/ext/client.dll +0 -0
  13. data/ruby/ext/svn/ext/core.dll +0 -0
  14. data/ruby/ext/svn/ext/delta.dll +0 -0
  15. data/ruby/ext/svn/ext/fs.dll +0 -0
  16. data/ruby/ext/svn/ext/intl3_svn.dll +0 -0
  17. data/ruby/ext/svn/ext/libapr-1.dll +0 -0
  18. data/ruby/ext/svn/ext/libaprutil-1.dll +0 -0
  19. data/ruby/ext/svn/ext/libdb44.dll +0 -0
  20. data/ruby/ext/svn/ext/libsvn_client-1.dll +0 -0
  21. data/ruby/ext/svn/ext/libsvn_delta-1.dll +0 -0
  22. data/ruby/ext/svn/ext/libsvn_diff-1.dll +0 -0
  23. data/ruby/ext/svn/ext/libsvn_fs-1.dll +0 -0
  24. data/ruby/ext/svn/ext/libsvn_ra-1.dll +0 -0
  25. data/ruby/ext/svn/ext/libsvn_repos-1.dll +0 -0
  26. data/ruby/ext/svn/ext/libsvn_subr-1.dll +0 -0
  27. data/ruby/ext/svn/ext/libsvn_swig_ruby-1.dll +0 -0
  28. data/ruby/ext/svn/ext/libsvn_wc-1.dll +0 -0
  29. data/ruby/ext/svn/ext/ra.dll +0 -0
  30. data/ruby/ext/svn/ext/repos.dll +0 -0
  31. data/ruby/ext/svn/ext/wc.dll +0 -0
  32. data/ruby/lib/svn/client.rb +771 -0
  33. data/ruby/lib/svn/core.rb +817 -0
  34. data/ruby/lib/svn/delta.rb +503 -0
  35. data/ruby/lib/svn/error.rb +74 -0
  36. data/ruby/lib/svn/fs.rb +628 -0
  37. data/ruby/lib/svn/info.rb +321 -0
  38. data/ruby/lib/svn/ra.rb +353 -0
  39. data/ruby/lib/svn/repos.rb +472 -0
  40. data/ruby/lib/svn/util.rb +129 -0
  41. data/ruby/lib/svn/wc.rb +689 -0
  42. metadata +96 -0
@@ -0,0 +1,771 @@
1
+ require "English"
2
+ require 'uri'
3
+ require "svn/error"
4
+ require "svn/util"
5
+ require "svn/core"
6
+ require "svn/wc"
7
+ require "svn/ra"
8
+ require "svn/ext/client"
9
+
10
+ module Svn
11
+ module Client
12
+ Util.set_constants(Ext::Client, self)
13
+ Util.set_methods(Ext::Client, self)
14
+
15
+ class CommitItem
16
+ class << self
17
+ undef new
18
+ end
19
+ end
20
+
21
+ class CommitItem2
22
+ class << self
23
+ undef new
24
+ end
25
+ end
26
+
27
+ class CommitItem3
28
+ alias_method :wcprop_changes, :incoming_prop_changes
29
+ alias_method :wcprop_changes=, :incoming_prop_changes=
30
+ end
31
+
32
+ class CommitItemWrapper
33
+ def initialize(item)
34
+ @item = item
35
+ end
36
+
37
+ def incoming_prop_changes
38
+ if @item.incoming_prop_changes
39
+ Util.hash_to_prop_array(@item.incoming_prop_changes)
40
+ else
41
+ nil
42
+ end
43
+ end
44
+ alias_method :wcprop_changes, :incoming_prop_changes
45
+
46
+ def method_missing(method, *args, &block)
47
+ @item.__send__(method, *args, &block)
48
+ end
49
+ end
50
+
51
+ class Info
52
+ alias url URL
53
+ alias repos_root_url repos_root_URL
54
+
55
+ alias _last_changed_date last_changed_date
56
+ def last_changed_date
57
+ Time.from_apr_time(_last_changed_date)
58
+ end
59
+ end
60
+
61
+
62
+ # For backward compatibility
63
+ class PropListItem
64
+ # Returns an URI for the item concerned with the instance.
65
+ attr_accessor :name
66
+
67
+ # Returns a Hash of properties, such as
68
+ # <tt>{propname1 => propval1, propname2 => propval2, ...}</tt>.
69
+ attr_accessor :props
70
+
71
+ alias_method :node_name, :name
72
+ alias_method :prop_hash, :props
73
+
74
+ def initialize(name, props)
75
+ @name = name
76
+ @props = props
77
+ end
78
+
79
+ def method_missing(meth, *args)
80
+ if @props.respond_to?(meth)
81
+ @props.__send__(meth, *args)
82
+ else
83
+ super
84
+ end
85
+ end
86
+ end
87
+
88
+ Context = Ctx
89
+ class Context
90
+ alias _auth_baton auth_baton
91
+ alias _auth_baton= auth_baton=
92
+ remove_method :auth_baton, :auth_baton=
93
+ private :_auth_baton, :_auth_baton=
94
+
95
+ include Core::Authenticatable
96
+
97
+ alias _initialize initialize
98
+ private :_initialize
99
+ def initialize
100
+ _initialize
101
+ self.auth_baton = Core::AuthBaton.new
102
+ init_callbacks
103
+ return unless block_given?
104
+ begin
105
+ yield(self)
106
+ ensure
107
+ destroy
108
+ end
109
+ end
110
+
111
+ def destroy
112
+ Svn::Destroyer.destroy(self)
113
+ end
114
+
115
+ def auth_baton=(baton)
116
+ super(baton)
117
+ self._auth_baton = auth_baton
118
+ end
119
+
120
+ def checkout(url, path, revision=nil, peg_rev=nil,
121
+ depth=nil, ignore_externals=false,
122
+ allow_unver_obstruction=false)
123
+ revision ||= "HEAD"
124
+ Client.checkout3(url, path, peg_rev, revision, depth,
125
+ ignore_externals, allow_unver_obstruction,
126
+ self)
127
+ end
128
+ alias co checkout
129
+
130
+ def mkdir(*paths)
131
+ paths = paths.first if paths.size == 1 and paths.first.is_a?(Array)
132
+ mkdir2(:paths => paths)
133
+ end
134
+
135
+ MKDIR_REQUIRED_ARGUMENTS_KEYS = [:paths]
136
+ def mkdir2(arguments)
137
+ optional_arguments_defaults = {
138
+ :make_parents => false,
139
+ :revprop_table => {},
140
+ }
141
+
142
+ arguments = optional_arguments_defaults.merge(arguments)
143
+ Util.validate_options(arguments,
144
+ optional_arguments_defaults.keys,
145
+ MKDIR_REQUIRED_ARGUMENTS_KEYS)
146
+ Client.mkdir3(normalize_path(arguments[:paths]),
147
+ arguments[:make_parents],
148
+ arguments[:revprop_table],
149
+ self)
150
+ end
151
+
152
+ def mkdir_p(*paths)
153
+ revprop_table = paths.pop if paths.last.is_a?(Hash)
154
+ paths = paths.first if paths.size == 1 and paths.first.is_a?(Array)
155
+ mkdir_p2(:paths => paths, :revprop_table => revprop_table || {})
156
+ end
157
+
158
+ def mkdir_p2(arguments)
159
+ mkdir2(arguments.update(:make_parents => true))
160
+ end
161
+
162
+ def commit(targets, recurse=true, keep_locks=false,
163
+ keep_changelist=false, changelist_name=nil,
164
+ revprop_table=nil)
165
+ targets = [targets] unless targets.is_a?(Array)
166
+ Client.commit4(targets, recurse, keep_locks, keep_changelist,
167
+ changelist_name, revprop_table, self)
168
+ end
169
+ alias ci commit
170
+
171
+ def status(path, rev=nil, depth_or_recurse=nil, get_all=false,
172
+ update=true, no_ignore=false,
173
+ ignore_externals=false, changelists_names=nil, &status_func)
174
+ depth = Core::Depth.infinity_or_immediates_from_recurse(depth_or_recurse)
175
+ changelists_names = [changelists_names] unless changelists_names.is_a?(Array) or changelists_names.nil?
176
+ Client.status3(path, rev, status_func,
177
+ depth, get_all, update, no_ignore,
178
+ ignore_externals, changelists_names, self)
179
+ end
180
+ alias st status
181
+
182
+ def add(path, recurse=true, force=false, no_ignore=false)
183
+ Client.add3(path, recurse, force, no_ignore, self)
184
+ end
185
+
186
+ def delete(paths, force=false, keep_local=false, revprop_table=nil)
187
+ paths = [paths] unless paths.is_a?(Array)
188
+ Client.delete3(paths, force, keep_local, revprop_table, self)
189
+ end
190
+ alias del delete
191
+ alias remove delete
192
+ alias rm remove
193
+
194
+ def rm_f(*paths)
195
+ paths = paths.first if paths.size == 1 and paths.first.is_a?(Array)
196
+ rm(paths, true)
197
+ end
198
+
199
+ def update(paths, rev="HEAD", depth=nil, ignore_externals=false,
200
+ allow_unver_obstruction=false, depth_is_sticky=false)
201
+ paths_is_array = paths.is_a?(Array)
202
+ paths = [paths] unless paths_is_array
203
+ result = Client.update3(paths, rev, depth, depth_is_sticky,
204
+ ignore_externals, allow_unver_obstruction,
205
+ self)
206
+ result = result.first unless paths_is_array
207
+ result
208
+ end
209
+ alias up update
210
+
211
+ def import(path, uri, depth_or_recurse=true, no_ignore=false, revprop_table=nil)
212
+ depth = Core::Depth.infinity_or_immediates_from_recurse(depth_or_recurse)
213
+ Client.import3(path, uri, depth, no_ignore, false, revprop_table, self)
214
+ end
215
+
216
+ def cleanup(dir)
217
+ Client.cleanup(dir, self)
218
+ end
219
+
220
+ def relocate(dir, from, to, recurse=true)
221
+ Client.relocate(dir, from, to, recurse, self)
222
+ end
223
+
224
+ def revert(paths, recurse=true)
225
+ paths = [paths] unless paths.is_a?(Array)
226
+ Client.revert(paths, recurse, self)
227
+ end
228
+
229
+ def resolved(path, recurse=true)
230
+ Client.resolved(path, recurse, self)
231
+ end
232
+
233
+ RESOLVE_REQUIRED_ARGUMENTS_KEYS = [:path]
234
+ def resolve(arguments={})
235
+ arguments = arguments.reject {|k, v| v.nil?}
236
+ optional_arguments_defaults = {
237
+ :depth => nil,
238
+ :conflict_choice => Wc::CONFLICT_CHOOSE_POSTPONE
239
+ }
240
+ arguments = optional_arguments_defaults.merge(arguments)
241
+ Util.validate_options(arguments,
242
+ optional_arguments_defaults.keys,
243
+ RESOLVE_REQUIRED_ARGUMENTS_KEYS)
244
+
245
+ Client.resolve(arguments[:path], arguments[:depth], arguments[:conflict_choice], self)
246
+ end
247
+
248
+ def propset(name, value, target, depth_or_recurse=nil, force=false,
249
+ base_revision_for_url=nil, changelists_names=nil,
250
+ revprop_table=nil)
251
+ base_revision_for_url ||= Svn::Core::INVALID_REVNUM
252
+ depth = Core::Depth.infinity_or_empty_from_recurse(depth_or_recurse)
253
+ changelists_names = [changelists_names] unless changelists_names.is_a?(Array) or changelists_names.nil?
254
+ Client.propset3(name, value, target, depth, force,
255
+ base_revision_for_url, changelists_names,
256
+ revprop_table, self)
257
+ end
258
+ alias prop_set propset
259
+ alias pset propset
260
+ alias ps propset
261
+
262
+ def propdel(name, *args)
263
+ propset(name, nil, *args)
264
+ end
265
+ alias prop_del propdel
266
+ alias pdel propdel
267
+ alias pd propdel
268
+
269
+ # Returns a value of a property, with +name+ attached to +target+,
270
+ # as a Hash such as <tt>{uri1 => value1, uri2 => value2, ...}</tt>.
271
+ def propget(name, target, rev=nil, peg_rev=nil, depth_or_recurse=nil,
272
+ changelists_names=nil)
273
+ rev ||= "HEAD"
274
+ peg_rev ||= rev
275
+ depth = Core::Depth.infinity_or_empty_from_recurse(depth_or_recurse)
276
+ changelists_names = [changelists_names] unless changelists_names.is_a?(Array) or changelists_names.nil?
277
+ Client.propget3(name, target, peg_rev, rev, depth, changelists_names, self).first
278
+ end
279
+ alias prop_get propget
280
+ alias pget propget
281
+ alias pg propget
282
+
283
+ # Obsoleted document.
284
+ #
285
+ # Returns list of properties attached to +target+ as an Array of
286
+ # Svn::Client::PropListItem.
287
+ # Paths and URIs are available as +target+.
288
+ def proplist(target, peg_rev=nil, rev=nil, depth_or_recurse=nil,
289
+ changelists_names=nil, &block)
290
+ rev ||= "HEAD"
291
+ peg_rev ||= rev
292
+ items = []
293
+ depth = Core::Depth.infinity_or_empty_from_recurse(depth_or_recurse)
294
+ receiver = Proc.new do |path, prop_hash|
295
+ items << PropListItem.new(path, prop_hash)
296
+ block.call(path, prop_hash) if block
297
+ end
298
+ changelists_names = [changelists_names] unless changelists_names.is_a?(Array) or changelists_names.nil?
299
+ Client.proplist3(target, peg_rev, rev, depth, changelists_names,
300
+ receiver, self)
301
+ items
302
+ end
303
+ alias prop_list proplist
304
+ alias plist proplist
305
+ alias pl proplist
306
+
307
+ def copy(src_paths, dst_path, rev_or_copy_as_child=nil,
308
+ make_parents=nil, revprop_table=nil)
309
+ if src_paths.is_a?(Array)
310
+ copy_as_child = rev_or_copy_as_child
311
+ if copy_as_child.nil?
312
+ copy_as_child = src_paths.size == 1 ? false : true
313
+ end
314
+ src_paths = src_paths.collect do |path|
315
+ if path.is_a?(CopySource)
316
+ path
317
+ else
318
+ CopySource.new(path)
319
+ end
320
+ end
321
+ else
322
+ copy_as_child = false
323
+ unless src_paths.is_a?(CopySource)
324
+ src_paths = CopySource.new(src_paths, rev_or_copy_as_child)
325
+ end
326
+ src_paths = [src_paths]
327
+ end
328
+ Client.copy4(src_paths, dst_path, copy_as_child, make_parents,
329
+ revprop_table, self)
330
+ end
331
+ alias cp copy
332
+
333
+ def move(src_paths, dst_path, force=false, move_as_child=nil,
334
+ make_parents=nil, revprop_table=nil)
335
+ src_paths = [src_paths] unless src_paths.is_a?(Array)
336
+ move_as_child = src_paths.size == 1 ? false : true if move_as_child.nil?
337
+ Client.move5(src_paths, dst_path, force, move_as_child, make_parents,
338
+ revprop_table, self)
339
+ end
340
+ alias mv move
341
+
342
+ def mv_f(src_paths, dst_path, move_as_child=nil)
343
+ move(src_paths, dst_path, true, move_as_child)
344
+ end
345
+
346
+ def diff(options, path1, rev1, path2, rev2,
347
+ out_file, err_file, depth=nil,
348
+ ignore_ancestry=false,
349
+ no_diff_deleted=false, force=false,
350
+ header_encoding=nil, relative_to_dir=nil, changelists=nil)
351
+ header_encoding ||= Core::LOCALE_CHARSET
352
+ relative_to_dir &&= Core.path_canonicalize(relative_to_dir)
353
+ Client.diff4(options, path1, rev1, path2, rev2, relative_to_dir,
354
+ depth, ignore_ancestry,
355
+ no_diff_deleted, force, header_encoding,
356
+ out_file, err_file, changelists, self)
357
+ end
358
+
359
+ def diff_peg(options, path, start_rev, end_rev,
360
+ out_file, err_file, peg_rev=nil,
361
+ depth=nil, ignore_ancestry=false,
362
+ no_diff_deleted=false, force=false,
363
+ header_encoding=nil, relative_to_dir=nil, changelists=nil)
364
+ header_encoding ||= Core::LOCALE_CHARSET
365
+ relative_to_dir &&= Core.path_canonicalize(relative_to_dir)
366
+ Client.diff_peg4(options, path, peg_rev, start_rev, end_rev,
367
+ relative_to_dir, depth, ignore_ancestry,
368
+ no_diff_deleted, force, header_encoding,
369
+ out_file, err_file, changelists, self)
370
+ end
371
+
372
+ # Invokes block once for each item changed between <tt>path1</tt>
373
+ # at <tt>rev1</tt> and <tt>path2</tt> at <tt>rev2</tt>,
374
+ # and returns +nil+.
375
+ # +diff+ is an instance of Svn::Client::DiffSummarize.
376
+ def diff_summarize(path1, rev1, path2, rev2,
377
+ depth=nil, ignore_ancestry=true, changelists=nil,
378
+ &block) # :yields: diff
379
+ Client.diff_summarize2(path1, rev1, path2, rev2,
380
+ depth, ignore_ancestry, changelists, block,
381
+ self)
382
+ end
383
+
384
+ def diff_summarize_peg(path1, rev1, rev2, peg_rev=nil,
385
+ depth=nil, ignore_ancestry=true, changelists=nil,
386
+ &block)
387
+ Client.diff_summarize_peg2(path1, rev1, rev2, peg_rev,
388
+ depth, ignore_ancestry, changelists, block,
389
+ self)
390
+ end
391
+
392
+ def merge(src1, rev1, src2, rev2, target_wcpath,
393
+ depth=nil, ignore_ancestry=false,
394
+ force=false, dry_run=false, options=nil, record_only=false)
395
+ Client.merge3(src1, rev1, src2, rev2, target_wcpath,
396
+ depth, ignore_ancestry, force, record_only,
397
+ dry_run, options, self)
398
+ end
399
+
400
+
401
+ def merge_peg(src, rev1, rev2, *rest)
402
+ merge_peg2(src, [[rev1, rev2]], *rest)
403
+ end
404
+
405
+ def merge_peg2(src, ranges_to_merge, target_wcpath,
406
+ peg_rev=nil, depth=nil,
407
+ ignore_ancestry=false, force=false,
408
+ dry_run=false, options=nil, record_only=false)
409
+ peg_rev ||= URI(src).scheme ? 'HEAD' : 'WORKING'
410
+ Client.merge_peg3(src, ranges_to_merge, peg_rev,
411
+ target_wcpath, depth, ignore_ancestry,
412
+ force, record_only, dry_run, options, self)
413
+ end
414
+
415
+ # Returns a content of +path+ at +rev+ as a String.
416
+ def cat(path, rev="HEAD", peg_rev=nil, output=nil)
417
+ used_string_io = output.nil?
418
+ output ||= StringIO.new
419
+ Client.cat2(output, path, peg_rev, rev, self)
420
+ if used_string_io
421
+ output.rewind
422
+ output.read
423
+ else
424
+ output
425
+ end
426
+ end
427
+
428
+ def lock(targets, comment=nil, steal_lock=false)
429
+ targets = [targets] unless targets.is_a?(Array)
430
+ Client.lock(targets, comment, steal_lock, self)
431
+ end
432
+
433
+ def unlock(targets, break_lock=false)
434
+ targets = [targets] unless targets.is_a?(Array)
435
+ Client.unlock(targets, break_lock, self)
436
+ end
437
+
438
+ def info(path_or_uri, rev=nil, peg_rev=nil, depth_or_recurse=false,
439
+ changelists=nil)
440
+ rev ||= URI(path_or_uri).scheme ? "HEAD" : "BASE"
441
+ depth = Core::Depth.infinity_or_empty_from_recurse(depth_or_recurse)
442
+ peg_rev ||= rev
443
+ receiver = Proc.new do |path, info|
444
+ yield(path, info)
445
+ end
446
+ Client.info2(path_or_uri, rev, peg_rev, receiver, depth, changelists,
447
+ self)
448
+ end
449
+
450
+ # Returns URL for +path+ as a String.
451
+ def url_from_path(path)
452
+ Client.url_from_path(path)
453
+ end
454
+
455
+ def uuid_from_path(path, adm)
456
+ Client.uuid_from_path(path, adm, self)
457
+ end
458
+
459
+ # Returns UUID for +url+ as a String.
460
+ def uuid_from_url(url)
461
+ Client.uuid_from_url(url, self)
462
+ end
463
+
464
+ def open_ra_session(url)
465
+ Client.open_ra_session(url, self)
466
+ end
467
+
468
+ # Scans revisions from +start_rev+ to +end_rev+ for each path in
469
+ # +paths+, invokes block once for each revision, and then returns
470
+ # +nil+.
471
+ #
472
+ # When +discover_changed_paths+ is +false+ or +nil+, +changed_paths+,
473
+ # the first block-argument, is +nil+. Otherwise, it is a Hash
474
+ # containing simple information associated with the revision,
475
+ # whose keys are paths and values are changes, such as
476
+ # <tt>{path1 => change1, path2 => change2, ...}</tt>,
477
+ # where each path is an absolute one in the repository and each
478
+ # change is a instance of Svn::Core::LogChangedPath.
479
+ # The rest of the block arguments, +rev+, +author+, +date+, and
480
+ # +message+ are the revision number, author, date, and the log
481
+ # message of that revision, respectively.
482
+ def log(paths, start_rev, end_rev, limit,
483
+ discover_changed_paths, strict_node_history,
484
+ peg_rev=nil)
485
+ paths = [paths] unless paths.is_a?(Array)
486
+ receiver = Proc.new do |changed_paths, rev, author, date, message|
487
+ yield(changed_paths, rev, author, date, message)
488
+ end
489
+ Client.log3(paths, peg_rev, start_rev, end_rev, limit,
490
+ discover_changed_paths,
491
+ strict_node_history,
492
+ receiver, self)
493
+ end
494
+
495
+ # Returns log messages, for commits affecting +paths+ from +start_rev+
496
+ # to +end_rev+, as an Array of String.
497
+ # You can use URIs as well as paths as +paths+.
498
+ def log_message(paths, start_rev=nil, end_rev=nil)
499
+ start_rev ||= "HEAD"
500
+ end_rev ||= start_rev
501
+ messages = []
502
+ receiver = Proc.new do |changed_paths, rev, author, date, message|
503
+ messages << message
504
+ end
505
+ log(paths, start_rev, end_rev, 0, false, false) do |*args|
506
+ receiver.call(*args)
507
+ end
508
+ if !paths.is_a?(Array) and messages.size == 1
509
+ messages.first
510
+ else
511
+ messages
512
+ end
513
+ end
514
+
515
+ def blame(path_or_uri, start_rev=nil, end_rev=nil, peg_rev=nil,
516
+ diff_options=nil, ignore_mime_type=false)
517
+ start_rev ||= 1
518
+ end_rev ||= URI(path_or_uri).scheme ? "HEAD" : "BASE"
519
+ peg_rev ||= end_rev
520
+ diff_options ||= Svn::Core::DiffFileOptions.new
521
+ receiver = Proc.new do |line_no, revision, author, date, line|
522
+ yield(line_no, revision, author, date, line)
523
+ end
524
+ Client.blame3(path_or_uri, peg_rev, start_rev,
525
+ end_rev, diff_options, ignore_mime_type,
526
+ receiver, self)
527
+ end
528
+ alias praise blame
529
+ alias annotate blame
530
+ alias ann annotate
531
+
532
+ # Returns a value of a revision property named +name+ for +uri+
533
+ # at +rev+, as a String.
534
+ # Both URLs and paths are available as +uri+.
535
+ def revprop(name, uri, rev)
536
+ value, = revprop_get(name, uri, rev)
537
+ value
538
+ end
539
+ alias rp revprop
540
+
541
+ # Returns a value of a revision property named +name+ for +uri+
542
+ # at +rev+, as an Array such as <tt>[value, rev]</tt>.
543
+ # Both URLs and paths are available as +uri+.
544
+ def revprop_get(name, uri, rev)
545
+ result = Client.revprop_get(name, uri, rev, self)
546
+ if result.is_a?(Array)
547
+ result
548
+ else
549
+ [nil, result]
550
+ end
551
+ end
552
+ alias rpget revprop_get
553
+ alias rpg revprop_get
554
+
555
+ # Sets +value+ as a revision property named +name+ for +uri+ at +rev+.
556
+ # Both URLs and paths are available as +uri+.
557
+ def revprop_set(name, value, uri, rev, force=false)
558
+ Client.revprop_set(name, value, uri, rev, force, self)
559
+ end
560
+ alias rpset revprop_set
561
+ alias rps revprop_set
562
+
563
+ # Deletes a revision property, named +name+, for +uri+ at +rev+.
564
+ # Both URLs and paths are available as +uri+.
565
+ def revprop_del(name, uri, rev, force=false)
566
+ Client.revprop_set(name, nil, uri, rev, force, self)
567
+ end
568
+ alias rpdel revprop_del
569
+ alias rpd revprop_del
570
+
571
+ # Returns a list of revision properties set for +uri+ at +rev+,
572
+ # as an Array such as
573
+ # <tt>[{revprop1 => value1, revprop2 => value2, ...}, rev]</tt>.
574
+ # Both URLs and paths are available as +uri+.
575
+ def revprop_list(uri, rev)
576
+ props, rev = Client.revprop_list(uri, rev, self)
577
+ if props.has_key?(Svn::Core::PROP_REVISION_DATE)
578
+ props[Svn::Core::PROP_REVISION_DATE] =
579
+ Time.from_svn_format(props[Svn::Core::PROP_REVISION_DATE])
580
+ end
581
+ [props, rev]
582
+ end
583
+ alias rplist revprop_list
584
+ alias rpl revprop_list
585
+
586
+ def export(from, to, rev=nil, peg_rev=nil,
587
+ force=false, ignore_externals=false,
588
+ depth=nil, native_eol=nil)
589
+ Client.export4(from, to, rev, peg_rev, force,
590
+ ignore_externals, depth, native_eol, self)
591
+ end
592
+
593
+ def ls(path_or_uri, rev=nil, peg_rev=nil, recurse=false)
594
+ rev ||= URI(path_or_uri).scheme ? "HEAD" : "BASE"
595
+ peg_rev ||= rev
596
+ Client.ls3(path_or_uri, rev, peg_rev, recurse, self)
597
+ end
598
+
599
+ # Invokes block once for each path below +path_or_uri+ at +rev+
600
+ # and returns +nil+.
601
+ # +path+ is a relative path from the +path_or_uri+.
602
+ # +dirent+ is an instance of Svn::Core::Dirent.
603
+ # +abs_path+ is an absolute path for +path_or_uri+ in the repository.
604
+ def list(path_or_uri, rev, peg_rev=nil, depth_or_recurse=Core::DEPTH_IMMEDIATES,
605
+ dirent_fields=nil, fetch_locks=true,
606
+ &block) # :yields: path, dirent, lock, abs_path
607
+ depth = Core::Depth.infinity_or_immediates_from_recurse(depth_or_recurse)
608
+ dirent_fields ||= Core::DIRENT_ALL
609
+ Client.list2(path_or_uri, peg_rev, rev, depth, dirent_fields,
610
+ fetch_locks, block, self)
611
+ end
612
+
613
+ def switch(path, uri, peg_rev=nil, rev=nil, depth=nil,
614
+ ignore_externals=false, allow_unver_obstruction=false,
615
+ depth_is_sticky=false)
616
+
617
+ Client.switch2(path, uri, peg_rev, rev, depth, depth_is_sticky,
618
+ ignore_externals, allow_unver_obstruction, self)
619
+ end
620
+
621
+ def set_log_msg_func(callback=Proc.new)
622
+ callback_wrapper = Proc.new do |items|
623
+ items = items.collect do |item|
624
+ item_wrapper = CommitItemWrapper.new(item)
625
+ end
626
+ callback.call(items)
627
+ end
628
+ set_log_msg_func2(callback_wrapper)
629
+ end
630
+
631
+ def set_log_msg_func2(callback=Proc.new)
632
+ @log_msg_baton = Client.set_log_msg_func3(self, callback)
633
+ end
634
+
635
+ def set_notify_func(callback=Proc.new)
636
+ @notify_baton = Client.set_notify_func2(self, callback)
637
+ end
638
+
639
+ def set_cancel_func(callback=Proc.new)
640
+ @cancel_baton = Client.set_cancel_func(self, callback)
641
+ end
642
+
643
+ def config=(new_config)
644
+ Client.set_config(self, new_config)
645
+ end
646
+
647
+ def config
648
+ Client.get_config(self)
649
+ end
650
+
651
+ def merged(path_or_url, peg_revision=nil)
652
+ info = Client.mergeinfo_get_merged(path_or_url, peg_revision, self)
653
+ return nil if info.nil?
654
+ Core::MergeInfo.new(info)
655
+ end
656
+
657
+ def log_merged(path_or_url, peg_revision, merge_source_url,
658
+ source_peg_revision, discover_changed_path=true,
659
+ interested_revision_prop_names=nil,
660
+ &receiver)
661
+ raise ArgumentError, "Block isn't given" if receiver.nil?
662
+ Client.mergeinfo_log_merged(path_or_url, peg_revision,
663
+ merge_source_url, source_peg_revision,
664
+ receiver, discover_changed_path,
665
+ interested_revision_prop_names,
666
+ self)
667
+ end
668
+
669
+ def add_to_changelist(changelist_name, paths, depth=nil, changelists_names=nil)
670
+ paths = [paths] unless paths.is_a?(Array)
671
+ changelists_names = [changelists_names] unless changelists_names.is_a?(Array) or changelists_names.nil?
672
+ Client.add_to_changelist(paths, changelist_name, depth, changelists_names, self)
673
+ end
674
+
675
+ def changelists(changelists_names, root_path, depth=nil, &block)
676
+ lists_contents = Hash.new{|h,k| h[k]=[]}
677
+ changelists_names = [changelists_names] unless changelists_names.is_a?(Array) or changelists_names.nil?
678
+ block ||= lambda{|path, changelist| lists_contents[changelist] << path }
679
+ Client.get_changelists(root_path, changelists_names, depth, block, self)
680
+ lists_contents
681
+ end
682
+
683
+ def remove_from_changelists(changelists_names, paths, depth=nil)
684
+ changelists_names = [changelists_names] unless changelists_names.is_a?(Array) or changelists_names.nil?
685
+ paths = [paths] unless paths.is_a?(Array)
686
+ Client.remove_from_changelists(paths, depth, changelists_names, self)
687
+ end
688
+
689
+ private
690
+ def init_callbacks
691
+ set_log_msg_func(nil)
692
+ set_notify_func(nil)
693
+ set_cancel_func(nil)
694
+ end
695
+ %w(log_msg notify cancel).each do |type|
696
+ private "#{type}_func", "#{type}_baton"
697
+ private "#{type}_func=", "#{type}_baton="
698
+ end
699
+ %w(notify).each do |type|
700
+ private "#{type}_func2", "#{type}_baton2"
701
+ private "#{type}_func2=", "#{type}_baton2="
702
+ end
703
+
704
+ def normalize_path(paths)
705
+ paths = [paths] unless paths.is_a?(Array)
706
+ paths.collect do |path|
707
+ path.chomp(File::SEPARATOR)
708
+ end
709
+ end
710
+ end
711
+
712
+ # Following methods are also available:
713
+ #
714
+ # [path]
715
+ # Returns a path concerned with the instance.
716
+ # [prop_changed?]
717
+ # Returns +true+ when the instance is a change involving a property
718
+ # change.
719
+ class DiffSummarize
720
+ alias prop_changed? prop_changed
721
+
722
+ # Returns +true+ when the instance is a normal change.
723
+ def kind_normal?
724
+ summarize_kind == DIFF_SUMMARIZE_KIND_NORMAL
725
+ end
726
+
727
+ # Returns +true+ when the instance is a change involving addition.
728
+ def kind_added?
729
+ summarize_kind == DIFF_SUMMARIZE_KIND_ADDED
730
+ end
731
+
732
+ # Returns +true+ when the instance is a change involving modification.
733
+ def kind_modified?
734
+ summarize_kind == DIFF_SUMMARIZE_KIND_MODIFIED
735
+ end
736
+
737
+ # Returns +true+ when the instance is a change involving deletion.
738
+ def kind_deleted?
739
+ summarize_kind == DIFF_SUMMARIZE_KIND_DELETED
740
+ end
741
+
742
+ # Returns +true+ when the instance is a change made to no node.
743
+ def node_kind_none?
744
+ node_kind == Core::NODE_NONE
745
+ end
746
+
747
+ # Returns +true+ when the instance is a change made to a file node.
748
+ def node_kind_file?
749
+ node_kind == Core::NODE_FILE
750
+ end
751
+
752
+ # Returns +true+ when the instance is a change made to a directory node.
753
+ def node_kind_dir?
754
+ node_kind == Core::NODE_DIR
755
+ end
756
+
757
+ # Returns +true+ when the instance is a change made to an unknown node.
758
+ def node_kind_unknown?
759
+ node_kind == Core::NODE_UNKNOWN
760
+ end
761
+ end
762
+
763
+ class CopySource
764
+ alias_method :_initialize, :initialize
765
+ private :_initialize
766
+ def initialize(path, rev=nil, peg_rev=nil)
767
+ _initialize(path, rev, peg_rev)
768
+ end
769
+ end
770
+ end
771
+ end