Ejemplo n.º 1
0
        static IntPtr svnclient_log_handler(IntPtr baton, IntPtr logEntryPtr, IntPtr pool)
        {
            var client = AprBaton <SvnClient> .Get(baton);

            if (!(client.CurrentCommandArgs is SvnLogArgs args))
            {
                return(IntPtr.Zero);
            }

            var logEntry = svn_log_entry_t.__CreateInstance(logEntryPtr);

            if (logEntry.revision == -1)
            {
                // This marks the end of logs at this level,
                args._mergeLogLevel--;
                return(IntPtr.Zero);
            }

            using AprPool aprPool = new AprPool(pool, false);

            var e = new SvnLogEventArgs(logEntry, args._mergeLogLevel, args._searchRoot, aprPool);

            if (logEntry.has_children)
            {
                args._mergeLogLevel++;
            }

            try
            {
                args.OnLog(e);

                if (e.Cancel)
                {
                    return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CEASE_INVOCATION, null, "Log receiver canceled operation").__Instance);
                }
                else
                {
                    return(IntPtr.Zero);
                }
            }
            catch (Exception ex)
            {
                return(SvnException.CreateExceptionSvnError("Log receiver", ex).__Instance);
            }
            finally
            {
                e.Detach(false);
            }
        }
Ejemplo n.º 2
0
        static unsafe IntPtr svnclient_list_handler(
            IntPtr baton,
            sbyte *path,
            IntPtr dirent,
            IntPtr @lock,
            sbyte *absPath,
            sbyte *externalParentUrl,
            sbyte *externalTarget,
            IntPtr pool)
        {
            var client = AprBaton <SvnClient> .Get(baton);

            if (!(client.CurrentCommandArgs is SvnListArgs args))
            {
                return(IntPtr.Zero);
            }

            var e = new SvnListEventArgs(
                path,
                svn_dirent_t.__CreateInstance(dirent),
                svn_lock_t.__CreateInstance(@lock),
                absPath,
                args.CalculateRepositoryRoot(absPath),
                externalParentUrl,
                externalTarget);

            try
            {
                args.OnList(e);

                if (e.Cancel)
                {
                    return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CEASE_INVOCATION, null, "List receiver canceled operation").__Instance);
                }
                else
                {
                    return(IntPtr.Zero);
                }
            }
            catch (Exception ex)
            {
                return(SvnException.CreateExceptionSvnError("List receiver", ex).__Instance);
            }
            finally
            {
                e.Detach(false);
            }
        }
Ejemplo n.º 3
0
        static unsafe IntPtr svnclient_status_handler(IntPtr baton, sbyte *path, IntPtr status_ptr, IntPtr scratch_pool)
        {
            var client = AprBaton <SvnClient> .Get(baton);

            using var aprPool = new AprPool(scratch_pool, false);

            if (!(client.CurrentCommandArgs is SvnStatusArgs args))
            {
                return(IntPtr.Zero);
            }

            var status = svn_client_status_t.__CreateInstance(status_ptr);
            var e      = new SvnStatusEventArgs(path, status, client, aprPool);

            try
            {
                args.OnStatus(e);

                if (e.Cancel)
                {
                    return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CEASE_INVOCATION, null, "Status receiver canceled operation").__Instance);
                }
                else
                {
                    return(IntPtr.Zero);
                }
            }
            catch (Exception ex)
            {
                return(SvnException.CreateExceptionSvnError("Status receiver", ex).__Instance);
            }
            finally
            {
                e.Detach(false);
            }
        }
Ejemplo n.º 4
0
        static unsafe IntPtr svn_info_receiver(IntPtr baton, sbyte *path, IntPtr info_ptr, IntPtr pool)
        {
            var client = AprBaton <SvnClient> .Get(baton);

            using var thePool = new AprPool(pool, false);

            if (!(client.CurrentCommandArgs is SvnInfoArgs args))
            {
                return(IntPtr.Zero);
            }

            var info = svn_client_info2_t.__CreateInstance(info_ptr);
            var e    = new SvnInfoEventArgs(SvnBase.Utf8_PathPtrToString(path, thePool), info, thePool);

            try
            {
                args.OnInfo(e);

                if (e.Cancel)
                {
                    return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CEASE_INVOCATION, null, "Info receiver canceled operation").__Instance);
                }
                else
                {
                    return(IntPtr.Zero);
                }
            }
            catch (Exception ex)
            {
                return(SvnException.CreateExceptionSvnError("Info receiver", ex).__Instance);
            }
            finally
            {
                e.Detach(false);
            }
        }