Exemplo n.º 1
0
        /// <summary>Streamingly lists directory entries in the repository. (<c>svn list</c>)</summary>
        public unsafe bool List(SvnTarget target, SvnListArgs args, EventHandler <SvnListEventArgs> listHandler)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            // We allow a null listHandler; 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);

            args.Prepare(target, args.Revision.RevisionType != SvnRevisionType.None);

            if (listHandler != null)
            {
                args.List += listHandler;
            }

            try
            {
                svn_opt_revision_t pegrev = target.Revision.AllocSvnRevision(pool);
                svn_opt_revision_t rev    = args.Revision.Or(target.Revision).AllocSvnRevision(pool);

                using var svnclient_list_func_handle = new SafeFuncHandle <svn_client_list_func2_t>(svnclient_list_handler);

                svn_error_t r = svn_client.svn_client_list3(
                    target.AllocAsString(pool),
                    pegrev,
                    rev,
                    (svn_depth_t)args.Depth,
                    (uint)args.RetrieveEntries,
                    args.RetrieveLocks,
                    args.IncludeExternals,
                    svnclient_list_func_handle.Get(),
                    _clientBaton.Handle,
                    CtxHandle,
                    pool.Handle);

                return(args.HandleResult(this, r, target));
            }
            finally
            {
                if (listHandler != null)
                {
                    args.List -= listHandler;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>Gets a list of directory entries in the repository. (<c>svn list</c>)</summary>
        public bool GetList(SvnTarget target, SvnListArgs args, out Collection <SvnListEventArgs> list)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            var results = new InfoItemCollection <SvnListEventArgs>();

            try
            {
                return(List(target, args, results.Handler));
            }
            finally
            {
                list = results;
            }
        }