Пример #1
0
 private SvnClientContext(svn_client_ctx_t *ptr)
 {
     mClientContext = ptr;
     mAuthBaton = new SvnAuthBaton();
     mNotifyFunc = SvnDelegate.NullFunc;
     mLogMsgFunc = SvnDelegate.NullFunc;
        		mCancelFunc = SvnDelegate.NullFunc;
 }
Пример #2
0
        public void Dispose()
        {
            SvnClientContext._activeContext = _lastContext;

            svn_client_ctx_t ctx = _client.CtxHandle;

            ctx.wc_ctx = _wcCtx;

            /*
             * SvnSshContext ssh = _client._sshContext;
             * if (ssh != null)
             *  ssh.OperationCompleted(_client.KeepSession);
             */
        }
Пример #3
0
        internal SvnClientContext(AprPool pool, SvnClientContext client)
        {
            if (client is null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            _ctxBaton = new AprBaton <SvnClientContext>(this);

            _pool   = pool;
            _parent = client;

            _ctx            = client.CtxHandle;
            _authentication = client.Authentication;
        }
Пример #4
0
        internal unsafe SvnClientContext(AprPool pool)
        {
            if (pool is null)
            {
                throw new ArgumentNullException(nameof(pool));
            }

            _ctxBaton  = new AprBaton <SvnClientContext>(this);
            _callbacks = new SvnClientCallbacks();

            _pool = pool;
            svn_client_ctx_t.__Internal *ctxInternal = null;

            // We manage the config hash ourselves
            var error = svn_client.svn_client_create_context2((void **)&ctxInternal, null, pool.Handle);

            if (error != null)
            {
                throw SvnException.Create(error);
            }

            var ctx = svn_client_ctx_t.__CreateInstance(new IntPtr(ctxInternal));

            ctx.cancel_func    = _callbacks.libsvnsharp_cancel_func.Get();
            ctx.cancel_baton   = _ctxBaton.Handle;
            ctx.progress_func  = _callbacks.libsvnsharp_progress_func.Get();
            ctx.progress_baton = _ctxBaton.Handle;
            ctx.log_msg_func3  = _callbacks.libsvnsharp_commit_log_func.Get();
            ctx.log_msg_baton3 = _ctxBaton.Handle;

            //TODO:
            //ctx.check_tunnel_func = libsvnsharp_check_tunnel_func;
            //ctx.open_tunnel_func = libsvnsharp_open_tunnel_func;
            //ctx.tunnel_baton = _ctxBaton.Handle;

            ctx.client_name = pool.AllocString(SvnBase._clientName);

            _ctx            = ctx;
            _authentication = new SvnAuthentication(this, pool);
        }
Пример #5
0
        public void Dispose()
        {
            SvnClientContext._activeContext = _lastContext;
            SvnClientArgs args = _client._currentArgs;

            if (args != null)
            {
                args._hooked = false;
            }

            _client._currentArgs = null;

            svn_client_ctx_t ctx = _client.CtxHandle;

            ctx.wc_ctx = _wcCtx;

            /*
             * SvnSshContext ssh = _client._sshContext;
             * if (ssh != null)
             *  ssh.OperationCompleted(_client.KeepSession);
             */
        }
Пример #6
0
        public SvnClient()
        {
            // Allocate the APR pool and the SVN client context.

            pool = newpool(IntPtr.Zero);

            if (svn_client_create_context(out ctx, pool) != IntPtr.Zero)
                throw new InvalidOperationException("Could not create a Subversion client context.");

            // Set the callbacks on the client context structure.

            // This is quite a roudabout way of doing this.  The task
            // is to set the notify field of the unmanaged structure
            // at the address 'ctx' -- with the address of a delegate.
            // There's no way to get an address for the delegate directly,
            // as far as I could figure out, so instead I create a managed
            // structure that mirrors the start of the unmanaged structure
            // I want to modify.  Then I marshal the managed structure
            // *onto* to unmanaged one, overwriting fields in the process.
            // I don't use references to the structure itself in the API
            // calls because it needs to be allocated by SVN.  I hope
            // this doesn't cause any memory leaks.
            ctxstruct = new svn_client_ctx_t();
            ctxstruct.NotifyFunc = new svn_wc_notify_func_t(svn_wc_notify_func_t_impl);
            ctxstruct.LogMsgFunc = new svn_client_get_commit_log_t(svn_client_get_commit_log_impl);
            Marshal.StructureToPtr(ctxstruct, ctx, false);
        }