Index: csvn/wc.py =================================================================== --- csvn/wc.py (revision 25433) +++ csvn/wc.py (working copy) @@ -6,8 +6,12 @@ class WC(object): """A SVN working copy.""" - def __init__(self, path="", user=None): - """Open a working copy directory relative to PATH""" + def __init__(self, path="", user=None, notify_func=None, log_func=None, + cancel_func=None, progress_func=None): + """Open a working copy directory relative to PATH + + Optional NOTIFY_FUNC, LOG_FUNC, CANCEL_FUNC and PROGRESS_FUNC may + be provided to be called during operations.""" self.pool = Pool() self.iterpool = Pool() @@ -16,6 +20,22 @@ self.client = POINTER(svn_client_ctx_t)() svn_client_create_context(byref(self.client), self.pool) self._as_parameter_ = POINTER(svn_ra_session_t)() + + if(notify_func): + self.client.contents.notify_func2 = \ + svn_wc_notify_func2_t(notify_func) + + if(log_func): + self.client.contents.log_msg_func2 = \ + svn_client_get_commit_log2_t(log_func) + + if(cancel_func): + self.client.contents.cancel_func = \ + svn_cancel_func_t(cancel_func) + + if(progress_func): + self.client.contents.progress_func = \ + svn_ra_progress_notify_func_t(progress_func) def copy(self, src, dest, rev = ""): """Copy SRC to DEST""" @@ -83,4 +103,24 @@ """Build a canonicalized path to an item in the WC""" return svn_path_canonicalize(os.path.join(self.path, path), self.iterpool) + + def set_notify_func(self, notify_func): + """Set the notification function to be called during operations""" + self.client.contents.notify_func2 = \ + svn_wc_notify_func2_t(notify_func) + + def set_log_func(self, log_func): + """Set the function to be called to get a log message.""" + self.client.contents.log_msg_func2 = \ + svn_client_get_commit_log2_t(log_func) + + def set_cancel_func(self, cancel_func): + """Set the cancel function to be called during operations.""" + self.client.contents.cancel_func = \ + svn_cancel_func_t(cancel_func) + + def set_progress_func(self, progress_func): + """Set the progress function to be called during operations.""" + self.client.contents.progress_func = \ + svn_ra_progress_notify_func_t(progress_func)