Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }