11 Util.set_constants(Ext::Ra, self)
12 Util.set_methods(Ext::Ra, self)
14 @@ra_pool = Svn::Core::Pool.new
15 Ra.initialize(@@ra_pool)
23 Session = SWIG::TYPE_p_svn_ra_session_t
27 def open(url, config=nil, callbacks=nil)
28 Ra.open2(url, callbacks, config || Svn::Core::Config.get)
33 Ra.get_latest_revnum(self)
35 alias latest_revision latest_revnum
37 def dated_revision(time)
38 Ra.get_dated_revision(self, time.to_apr_time)
41 def set_prop(name, value, rev=nil)
42 Ra.change_rev_prop(self, rev || latest_revnum, name, value)
47 set_prop(name, value, *args)
52 Ra.rev_proplist(self, rev || latest_revnum)
54 alias properties proplist
56 def prop(name, rev=nil)
57 Ra.rev_prop(self, rev || latest_revnum, name)
61 def commit_editor(log_msg, lock_tokens={}, keep_lock=false)
62 callback = Proc.new do |new_revision, date, author|
63 yield(new_revision, date, author)
65 editor, editor_baton = Ra.get_commit_editor(self, log_msg, callback,
66 lock_tokens, keep_lock)
67 editor.baton = editor_baton
68 [editor, editor_baton]
71 def commit_editor2(log_msg_or_rev_props, lock_tokens={},
72 keep_lock=false, &callback)
73 if log_msg_or_rev_props.is_a?(Hash)
74 rev_props = log_msg_or_rev_props
76 rev_props = {Svn::Core::PROP_REVISION_LOG => log_msg_or_rev_props}
78 editor, editor_baton = Ra.get_commit_editor3(self, rev_props, callback,
79 lock_tokens, keep_lock)
80 editor.baton = editor_baton
84 def file(path, rev=nil)
87 fetched_rev, props = Ra.get_file(self, path, rev, output)
93 def dir(path, rev=nil, fields=nil)
95 fields ||= Core::DIRENT_ALL
96 entries, fetched_rev, props = Ra.get_dir2(self, path, rev, fields)
101 def update(revision_to_update_to, update_target,
102 editor, editor_baton, depth=nil, &block)
103 editor.baton = editor_baton
104 update2(revision_to_update_to, update_target,
105 editor, depth, &block)
108 def update2(revision_to_update_to, update_target, editor, depth=nil,
109 send_copyfrom_args=nil)
110 reporter, reporter_baton = Ra.do_update2(self, revision_to_update_to,
111 update_target, depth,
112 send_copyfrom_args, editor)
113 reporter.baton = reporter_baton
116 reporter.finish_report
123 def switch(revision_to_switch_to, switch_target, switch_url,
124 editor, editor_baton, depth=nil, &block)
125 editor.baton = editor_baton
126 switch2(revision_to_switch_to, switch_target, switch_url,
127 editor, depth, &block)
130 def switch2(revision_to_switch_to, switch_target, switch_url,
132 reporter, reporter_baton = Ra.do_switch2(self, revision_to_switch_to,
133 switch_target, depth,
135 reporter.baton = reporter_baton
138 reporter.finish_report
145 def status(revision, status_target, editor, editor_baton,
146 recurse=true, &block)
147 editor.baton = editor_baton
148 status2(revision, status_target, editor, recurse, &block)
151 def status2(revision, status_target, editor, recurse=true)
152 reporter, reporter_baton = Ra.do_status2(self, status_target,
153 revision, recurse, editor)
154 reporter.baton = reporter_baton
157 reporter.finish_report
164 def diff(rev, target, versus_url, editor,
165 depth=nil, ignore_ancestry=true, text_deltas=true)
166 args = [self, rev, target, depth, ignore_ancestry,
167 text_deltas, versus_url, editor]
168 reporter, baton = Ra.do_diff3(*args)
169 reporter.baton = baton
173 def log(paths, start_rev, end_rev, limit,
174 discover_changed_paths=true,
175 strict_node_history=false)
176 paths = [paths] unless paths.is_a?(Array)
177 receiver = Proc.new do |changed_paths, revision, author, date, message|
178 yield(changed_paths, revision, author, date, message)
180 Ra.get_log(self, paths, start_rev, end_rev, limit,
181 discover_changed_paths, strict_node_history,
185 def check_path(path, rev=nil)
186 Ra.check_path(self, path, rev || latest_revnum)
189 def stat(path, rev=nil)
190 Ra.stat(self, path, rev || latest_revnum)
198 Ra.get_repos_root(self)
201 def locations(path, location_revisions, peg_revision=nil)
202 peg_revision ||= latest_revnum
203 Ra.get_locations(self, path, peg_revision, location_revisions)
206 def file_revs(path, start_rev, end_rev=nil)
207 args = [path, start_rev, end_rev]
209 revs = file_revs2(*args) do |path, rev, rev_props, prop_diffs|
210 yield(path, rev, rev_props, Util.hash_to_prop_array(prop_diffs))
213 revs = file_revs2(*args)
215 revs.collect do |path, rev, rev_props, prop_diffs|
216 [path, rev, rev_props, Util.hash_to_prop_array(prop_diffs)]
220 def file_revs2(path, start_rev, end_rev=nil)
221 end_rev ||= latest_revnum
223 handler = Proc.new do |path, rev, rev_props, prop_diffs|
224 revs << [path, rev, rev_props, prop_diffs]
225 yield(path, rev, rev_props, prop_diffs) if block_given?
227 Ra.get_file_revs(self, path, start_rev, end_rev, handler)
231 def lock(path_revs, comment=nil, steal_lock=false)
232 lock_func = Proc.new do |path, do_lock, lock, ra_err|
233 yield(path, do_lock, lock, ra_err)
235 Ra.lock(self, path_revs, comment, steal_lock, lock_func)
238 def unlock(path_tokens, break_lock=false, &lock_func)
239 Ra.unlock(self, path_tokens, break_lock, lock_func)
243 Ra.get_lock(self, path)
247 Ra.get_locks(self, path)
250 def replay(rev, low_water_mark, editor, send_deltas=true)
251 Ra.replay(self, rev, low_water_mark, send_deltas, editor)
255 Ra.reparent(self, url)
258 def mergeinfo(paths, revision=nil, inherit=nil, include_descendants=false)
259 paths = [paths] unless paths.is_a?(Array)
260 revision ||= Svn::Core::INVALID_REVNUM
261 info = Ra.get_mergeinfo(self, paths, revision, inherit,
264 info.each_key do |key|
265 info[key] = Core::MergeInfo.new(info[key])
272 def props_filter(props)
273 date_str = props[Svn::Core::PROP_ENTRY_COMMITTED_DATE]
275 date = Time.parse_svn_format(date_str)
276 props[Svn::Core::PROP_ENTRY_COMMITTED_DATE] = date
284 def set_path(path, revision, depth=nil, start_empty=true,
286 Ra.reporter3_invoke_set_path(self, @baton, path, revision,
287 depth, start_empty, lock_token)
290 def delete_path(path)
291 Ra.reporter3_invoke_delete_path(self, @baton, path)
294 def link_path(path, url, revision, depth=nil,
295 start_empty=true, lock_token=nil)
296 Ra.reporter3_invoke_link_path(self, @baton, path, url,
297 revision, depth, start_empty, lock_token)
301 Ra.reporter3_invoke_finish_report(self, @baton)
305 Ra.reporter3_invoke_abort_report(self, @baton)
309 remove_const(:Callbacks)
311 include Core::Authenticatable
313 def initialize(auth_baton=nil)
314 self.auth_baton = auth_baton || Core::AuthBaton.new
318 tmp = Tempfile.new("Svn::Ra")
324 def get_wc_prop(relpath, name)
328 def set_wc_prop(path, name, value)
331 def push_wc_prop(path, name, value)
334 def invalidate_wc_props(path, name)
337 def progress_func(progress, total)