Ejemplo n.º 1
0
        public unsafe ArgsStore(SvnClientContext client, SvnClientArgs args, AprPool pool)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }
            if (client._currentArgs != null)
            {
                throw new InvalidOperationException(SharpSvnStrings.SvnClientOperationInProgress);
            }

            args.Prepare();
            client._currentArgs = args;
            _client             = client;

            var ctx = _client.CtxHandle;

            _wcCtx = ctx.wc_ctx;

            {
                svn_client__private_ctx_t pctx = libsvnsharp_client.svn_client__get_private_ctx(ctx);
                pctx.total_progress = 0;
            }

            _lastContext = SvnClientContext._activeContext;
            SvnClientContext._activeContext = _client;

            try
            {
                if (!client.KeepSession && pool != null)
                {
                    svn_wc_context_t.__Internal *p_wc_ctx = null;

                    var error = svn_wc.svn_wc_context_create((void **)&p_wc_ctx, null, pool.Handle, pool.Handle);
                    if (error != null)
                    {
                        throw SvnException.Create(error);
                    }

                    ctx.wc_ctx = svn_wc_context_t.__CreateInstance(new IntPtr(p_wc_ctx));
                }

                client.HandleProcessing(new SvnProcessingEventArgs(args.CommandType));
            }
            catch (Exception)
            {
                client._currentArgs             = null;
                SvnClientContext._activeContext = _lastContext;
                throw;
            }
        }
Ejemplo n.º 2
0
        internal SvnAuthentication(SvnClientContext context, AprPool parentPool)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            _wrappers = new Dictionary <Delegate, ISvnAuthWrapper>();
            _handlers = new List <ISvnAuthWrapper>();

            _parentPool    = parentPool;
            _authPool      = new AprPool(_parentPool);
            _clientContext = context;

            AddSubversionFileHandlers(); // Add handlers which use no interaction by default
        }
Ejemplo n.º 3
0
        public bool IsVersioned(string path)
        {
            this.QueryPath = path;
            try
            {
                try
                {
                    AprPool          p   = Svn.PoolCreate();
                    SvnClientContext ctx = SvnClientContext.Create(p);
                    ctx.Config  = SvnConfig.GetConfig(p);
                    this.Client = new SvnClient(ctx, p);

                    String AdminDir = ".svn";
                    if (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("SVN_ASP_DOT_NET_HACK")))
                    {
                        AdminDir = "_svn";
                    }

                    this.Client.SetWcAdmDir(AdminDir);
                    this.Client.AddSimpleProvider();
                    this.Client.AddUsernameProvider();
                    this.Client.AddSslServerTrustFileProvider();
                    this.Client.AddSslClientCertFileProvider();
                    this.Client.AddSslClientCertPwFileProvider();
                    this.Client.OpenAuth();
                    this.Client.Status2(this.QueryPath, new SvnRevision(Svn.Revision.Head), new SvnWcStatus2.Func(this.Record), IntPtr.Zero, false, true, false, false, true);
                    return(this.IsVersionedReturnValue);
                }
                catch (SvnException SvnEx)
                {
                    if (SvnEx.AprErr == 155007)
                    {
                        return(false);
                    }
                    throw new BuildException(SvnEx.Message, SvnEx);
                }
                catch (Exception ex)
                {
                    throw new BuildException(ex.Message, ex);
                }
            }
            finally
            {
                this.Client.Pool.Destroy();
            }
        }
Ejemplo n.º 4
0
        protected override void ExecuteTask()
        {
            try
            {
                try
                {
                    AprPool          p   = Svn.PoolCreate();
                    SvnClientContext ctx = SvnClientContext.Create(p);
                    ctx.Config  = SvnConfig.GetConfig(p);
                    this.Client = new SvnClient(ctx, p);

                    String AdminDir = ".svn";
                    if (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("SVN_ASP_DOT_NET_HACK")))
                    {
                        AdminDir = "_svn";
                    }

                    this.Client.SetWcAdmDir(AdminDir);
                    this.Client.AddSimpleProvider();
                    this.Client.AddUsernameProvider();
                    this.Client.AddSslServerTrustFileProvider();
                    this.Client.AddSslClientCertFileProvider();
                    this.Client.AddSslClientCertPwFileProvider();
                    this.Client.OpenAuth();
                    this.Client.Status2(this.Directory, new SvnRevision(Svn.Revision.Head), new SvnWcStatus2.Func(this.Clean), IntPtr.Zero, this.Recurse, true, false, false, false);

                    if (this.DeleteIgnored)
                    {
                        this.DeleteIgnoredFiles();
                    }
                }
                catch (Exception ex)
                {
                    throw new BuildException(ex.Message, this.Location, ex);
                }
            }
            finally
            {
                if (this.Client != null)
                {
                    this.Client.Pool.Destroy();
                }
            }
        }
        internal void Bind(SvnClientContext svnClient, SvnUIBindArgs args)
        {
            Image        = args.HeaderImage;
            UIService    = args.UIService;
            Synchronizer = args.Synchronizer;

            if (!args.AutoScaleBaseSize.IsEmpty)
            {
                AutoScaleBaseSize = args.AutoScaleBaseSize;
            }

            svnClient.Authentication.UserNameHandlers                     += DialogUserNameHandler;
            svnClient.Authentication.UserNamePasswordHandlers             += DialogUserNamePasswordHandler;
            svnClient.Authentication.SslClientCertificateHandlers         += DialogSslClientCertificateHandler;
            svnClient.Authentication.SslClientCertificatePasswordHandlers += DialogSslClientCertificatePasswordHandler;
            svnClient.Authentication.SslServerTrustHandlers               += DialogSslServerTrustHandler;
            svnClient.Authentication.SshServerTrustHandlers               += DialogSshServerTrustHandlers;
            svnClient.Authentication.BeforeEngineDialog                   += new EventHandler <SharpSvn.Security.SvnBeforeEngineDialogEventArgs>(BeforeEngineDialog);
        }
Ejemplo n.º 6
0
        protected override void ExecuteTask()
        {
            try
            {
                try
                {
                    AprPool          p   = Svn.PoolCreate();
                    SvnClientContext ctx = SvnClientContext.Create(p);
                    ctx.Config  = SvnConfig.GetConfig(p);
                    this.Client = new SvnClient(ctx, p);

                    String AdminDir = ".svn";
                    if (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("SVN_ASP_DOT_NET_HACK")))
                    {
                        AdminDir = "_svn";
                    }

                    this.Client.SetWcAdmDir(AdminDir);
                    this.Client.AddSslClientCertFileProvider();
                    this.Client.AddSslClientCertPwFileProvider();
                    this.Client.AddPromptProvider(UsernameAuth, IntPtr.Zero, 0);
                    this.Client.AddPromptProvider(SimpleAuth, IntPtr.Zero, 0);
                    this.Client.AddPromptProvider(SslServerTrustAuth, IntPtr.Zero);
                    this.Client.AddSslServerTrustFileProvider();
                    this.Client.OpenAuth();

                    this.Client.Checkout2(this.Url, this.Directory, new SvnRevision(Svn.Revision.Unspecified), new SvnRevision(Svn.Revision.Head), this.Recurse, this.Externals);
                }
                catch (Exception ex)
                {
                    throw new BuildException(ex.Message, this.Location, ex);
                }
            }
            finally
            {
                if (this.Client != null)
                {
                    this.Client.Pool.Destroy();
                }
            }
        }
Ejemplo n.º 7
0
 public bool IsVersioned(string path)
 {
     this.QueryPath = path;
     try
     {
         try
         {
             AprPool          p   = Svn.PoolCreate();
             SvnClientContext ctx = SvnClientContext.Create(p);
             ctx.Config  = SvnConfig.GetConfig(p);
             this.Client = new SvnClient(ctx, p);
             this.Client.AddSimpleProvider();
             this.Client.AddUsernameProvider();
             this.Client.AddSslServerTrustFileProvider();
             this.Client.AddSslClientCertFileProvider();
             this.Client.AddSslClientCertPwFileProvider();
             this.Client.OpenAuth();
             this.Client.Status2(this.QueryPath, new SvnRevision(Svn.Revision.Head), new SvnWcStatus2.Func(this.Record), IntPtr.Zero, false, true, false, false, true);
             return(this.IsVersionedReturnValue);
         }
         catch (SvnException SvnEx)
         {
             if (SvnEx.AprErr == 155007)
             {
                 return(false);
             }
             throw new BuildException(SvnEx.Message, SvnEx);
         }
         catch (Exception ex)
         {
             throw new BuildException(ex.Message, ex);
         }
     }
     finally
     {
         this.Client.Pool.Destroy();
     }
 }
Ejemplo n.º 8
0
        public unsafe NoArgsStore(SvnClientContext client, AprPool pool)
        {
            if (client._currentArgs != null)
            {
                throw new InvalidOperationException(SharpSvnStrings.SvnClientOperationInProgress);
            }

            _client = client;

            var ctx = _client.CtxHandle;

            _wcCtx = ctx.wc_ctx;

            _lastContext = SvnClientContext._activeContext;
            SvnClientContext._activeContext = _client;

            try
            {
                if (!client.KeepSession && pool != null)
                {
                    svn_wc_context_t.__Internal *p_wc_ctx = null;

                    var error = svn_wc.svn_wc_context_create((void **)&p_wc_ctx, null, pool.Handle, pool.Handle);
                    if (error != null)
                    {
                        throw SvnException.Create(error);
                    }

                    ctx.wc_ctx = svn_wc_context_t.__CreateInstance(new IntPtr(p_wc_ctx));
                }
            }
            catch (Exception)
            {
                SvnClientContext._activeContext = _lastContext;
                throw;
            }
        }
Ejemplo n.º 9
0
        public virtual int Run(Application.SubCommand sc, string[] args)
        {
            int res;

            mSubCmd = sc;
            BreakSingleDashManyLettersIntoManyOptions = true;
            ProcessArgs(args);

            try {
                AprPool          p   = Svn.PoolCreate();
                SvnClientContext ctx = SvnClientContext.Create(p);
                if (oConfigDir != null)
                {
                    ctx.Config = SvnConfig.GetConfig(new SvnPath(oConfigDir, p), p);
                }
                else
                {
                    ctx.Config = SvnConfig.GetConfig(p);
                }

                client = new SvnClient(ctx, p);

                client.AddSimpleProvider();
                client.AddUsernameProvider();
                client.AddSslServerTrustFileProvider();
                client.AddSslClientCertFileProvider();
                client.AddSslClientCertPwFileProvider();

                if (oInteractive)
                {
                    client.AddPromptProvider(
                        new SvnAuthProviderObject.SimplePrompt(SimpleAuth),
                        IntPtr.Zero, 2);
                    client.AddPromptProvider(
                        new SvnAuthProviderObject.UsernamePrompt(UsernameAuth),
                        IntPtr.Zero, 2);
                    client.AddPromptProvider(
                        new SvnAuthProviderObject.SslServerTrustPrompt(SslServerTrustAuth),
                        IntPtr.Zero);
                }
                client.OpenAuth();

                if (!oQuiet)
                {
                    client.Context.NotifyFunc = new SvnDelegate(new SvnWcNotify.Func(NotifyCallback));
                }

                client.Context.LogMsgFunc = new SvnDelegate(new SvnClient.GetCommitLog(GetCommitLogCallback));
                client.Context.CancelFunc = new SvnDelegate(new Svn.CancelFunc(CancelCallback));

                res = Execute();
            }
            catch (Exception e)
            {
                if (oDebug)
                {
                    Console.WriteLine(e);
                }
                else
                {
                    Console.WriteLine(e.Message);
                }
                res = -1;
            }
            finally
            {
                client.Pool.Destroy();
            }
            return(res);
        }
Ejemplo n.º 10
0
 public CommitResultReceiver(SvnClientContext client)
 {
     CommitCallback = new SafeFuncHandle <svn_commit_callback2_t>(the_commit_callback2);
     _commitBaton   = new AprBaton <CommitResultReceiver>(this);
     _client        = client;
 }