Ejemplo n.º 1
0
        internal static unsafe apr_hash_t CreateRevPropList(SvnRevisionPropertyCollection revProps, AprPool pool)
        {
            if (pool == null)
            {
                throw new ArgumentNullException(nameof(pool));
            }

            if (revProps != null && revProps.Count != 0)
            {
                apr_hash_t items = apr_hash.apr_hash_make(pool.Handle);

                foreach (SvnPropertyValue value in revProps)
                {
                    sbyte *key = pool.AllocString(value.Key);

                    var val = pool.AllocSvnString((byte[])value.RawValue);

                    apr_hash.apr_hash_set(items, new IntPtr(key), Constants.APR_HASH_KEY_STRING, val.__Instance);
                }

                return(items);
            }

            return(null);
        }
Ejemplo n.º 2
0
        static unsafe IntPtr _libsvnsharp_commit_log_func(
            sbyte **logMsg, sbyte **tmpFile, IntPtr commitItemsPtr, IntPtr baton, IntPtr pool)
        {
            var client = AprBaton <SvnClientContext> .Get(baton);

            var tmpPool = new AprPool(pool, false);

            var commit_items = apr_array_header_t.__CreateInstance(commitItemsPtr);

            var ea = new SvnCommittingEventArgs(commit_items, client.CurrentCommandArgs.CommandType, tmpPool);

            *logMsg  = null;
            *tmpFile = null;

            try
            {
                client.HandleClientCommitting(ea);

                if (ea.Cancel)
                {
                    return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CANCELLED, null, "Operation canceled from OnCommitting").__Instance);
                }
                else if (ea.LogMessage != null)
                {
                    *logMsg = tmpPool.AllocUnixString(ea.LogMessage);
                }
                else if (!client._noLogMessageRequired)
                {
                    return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CANCELLED, null, "Commit canceled: A logmessage is required").__Instance);
                }
                else
                {
                    *logMsg = tmpPool.AllocString("");
                }

                return(IntPtr.Zero);
            }
            catch (Exception e)
            {
                return(SvnException.CreateExceptionSvnError("Commit log", e).__Instance);
            }
            finally
            {
                ea.Detach(false);

                tmpPool.Dispose();
            }
        }
Ejemplo n.º 3
0
        public void Write(string value, IntPtr ptr, AprPool pool)
        {
            var ppStr = (sbyte **)ptr;

            *ppStr = pool.AllocString(value);
        }