Esempio n. 1
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);
             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);
         }
         catch (Exception ex)
         {
             throw new BuildException(ex.Message, this.Location, ex);
         }
     }
     finally
     {
         if (this.Client != null)
         {
             this.Client.Pool.Destroy();
         }
     }
 }
Esempio n. 2
0
        public void GetIgnoredFiles(String refID, String directoryName, bool recursive)
        {
            if (!this.Project.DataTypeReferences.Contains(refID))
            {
                throw new BuildException(String.Format("The refid {0} is not defined.", refID));
            }

            FileSet RefFileSet = (FileSet)this.Project.DataTypeReferences[refID];

            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();
                AprArray crapList = this.Client.PropList(directoryName, new SvnRevision(Svn.Revision.Working), recursive);
                crapList.ElementType = typeof(SvnClientPropListItem);
                SvnClientPropListItem[] props = new SvnClientPropListItem[crapList.Count];
                crapList.CopyTo(props, 0);

                foreach (SvnClientPropListItem property in props)
                {
                    foreach (AprHashEntry entry in property.PropHash)
                    {
                        if (entry.KeyAsString == "svn:ignore")
                        {
                            foreach (String ignored in new SvnString(entry.Value).Data.Value.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
                            {
                                string FullPath = Path.Combine(property.NodeName.ToString(), ignored);

                                RefFileSet.Includes.Add(FullPath);
                            }
                        }
                    }
                }
            }
            finally
            {
                if (this.Client != null)
                {
                    this.Client.Pool.Destroy();
                }
            }
        }
Esempio 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();
            }
        }
Esempio 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();
                }
            }
        }
Esempio n. 5
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();
                }
            }
        }
Esempio n. 6
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();
     }
 }
Esempio n. 7
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);
        }