Example #1
0
        /// <summary>Streamingly retrieves information about a local or remote item (<c>svn info</c>)</summary>
        public unsafe bool Info(SvnTarget target, SvnInfoArgs args, EventHandler <SvnInfoEventArgs> infoHandler)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            // We allow a null infoHandler; the args object might just handle it itself

            EnsureState(SvnContextState.AuthorizationInitialized);
            using var pool  = new AprPool(_pool);
            using var store = new ArgsStore(this, args, pool);

            if (infoHandler != null)
            {
                args.Info += infoHandler;
            }

            try
            {
                var pegRev = target.GetSvnRevision(SvnRevision.None, SvnRevision.Head).AllocSvnRevision(pool);
                var rev    = args.Revision.Or(target.GetSvnRevision(SvnRevision.None, SvnRevision.Head)).AllocSvnRevision(pool);

                using var svn_info_receiver_handle = new SafeFuncHandle <svn_client_info_receiver2_t>(svn_info_receiver);

                svn_error_t r = svn_client.svn_client_info4(
                    target.AllocAsString(pool, true),
                    pegRev,
                    rev,
                    (svn_depth_t)args.Depth,
                    args.RetrieveExcluded,
                    args.RetrieveActualOnly,
                    args.IncludeExternals,
                    CreateChangeListsList(args.ChangeLists, pool), // Intersect ChangeLists
                    svn_info_receiver_handle.Get(),
                    _clientBaton.Handle,
                    CtxHandle,
                    pool.Handle);

                return(args.HandleResult(this, r, target));
            }
            finally
            {
                if (infoHandler != null)
                {
                    args.Info -= infoHandler;
                }
            }
        }
Example #2
0
        /// <summary>Exports the specified target to the specified path</summary>
        /// <remarks>Subversion optimizes this call if you specify a workingcopy file instead of an url</remarks>
        public unsafe bool Export(SvnTarget from, string toPath, SvnExportArgs args, out SvnUpdateResult result)
        {
            if (from == null)
            {
                throw new ArgumentNullException(nameof(from));
            }
            if (toPath == null)
            {
                throw new ArgumentNullException(nameof(toPath));
            }
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            EnsureState(SvnContextState.AuthorizationInitialized);

            using var pool  = new AprPool(_pool);
            using var store = new ArgsStore(this, args, pool);

            result = null;

            int resultRev             = 0;
            svn_opt_revision_t pegRev = from.Revision.AllocSvnRevision(pool);
            svn_opt_revision_t rev    = args.Revision.Or(from.GetSvnRevision(SvnRevision.Working, SvnRevision.Head)).AllocSvnRevision(pool);

            svn_error_t r = svn_client.svn_client_export5(
                ref resultRev,
                from.AllocAsString(pool),
                pool.AllocDirent(toPath),
                pegRev,
                rev,
                args.Overwrite,
                args.IgnoreExternals,
                args.IgnoreKeywords,
                (svn_depth_t)args.Depth,
                pool.AllocString(GetEolPtr(args.LineStyle)),
                CtxHandle,
                pool.Handle);

            if (args.HandleResult(this, r, from))
            {
                result = SvnUpdateResult.Create(this, args, resultRev);
                return(true);
            }

            return(false);
        }