Пример #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();
         }
     }
 }
Пример #2
0
        public static FileChanged[] GetChangeSetFromSvn(DateTime startDateTime, DateTime endDateTime, SvnConfig server)
        {
            SvnRevisionRange range = new SvnRevisionRange(new SvnRevision(startDateTime), new SvnRevision(endDateTime));
            Collection<SvnLogEventArgs> logitems;

            var uri = new Uri(server.Url);
            FileChanged[] changed;
            using (SvnClient client = new SvnClient())
            {
                client.Authentication.Clear(); // Disable all use of the authentication area
                client.Authentication.UserNamePasswordHandlers +=
                    delegate(object sender, SvnUserNamePasswordEventArgs e)
                        {
                            e.UserName = server.UserName;
                            e.Password = server.Password;
                            e.Save = true;
                        };
                client.Authentication.SslServerTrustHandlers += delegate(object sender, SvnSslServerTrustEventArgs e)
                    {
                        e.AcceptedFailures = e.Failures;
                        e.Save = true; // Save acceptance to authentication store
                    };
                client.GetLog(uri, new SvnLogArgs(range), out logitems);
                foreach (var svnLogEventArgse in logitems)
                {
                    Console.WriteLine((string) WriteString(svnLogEventArgse));
                }
                changed = logitems.SelectMany<SvnLogEventArgs, FileChanged>(l => GetChangedFiles(l)).ToArray();
            }
            return changed;
        }
Пример #3
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();
                }
            }
        }
Пример #4
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();
            }
        }
Пример #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.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();
                }
            }
        }
Пример #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();
                }
            }
        }
Пример #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();
     }
 }
Пример #8
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);
        }
Пример #9
0
 protected void When_config_file_is(string configFile)
 {
     string path = string.Concat(@"Subversion\TestConfigurations\", configFile);
     Configuration appConfig = ConfigLoader.Load(path);
     svnConfig = (SvnConfig)SvnConfig.GetConfiguration(appConfig);
 }
Пример #10
0
 public static IEnumerable<FileChanged> GetChangeSetFromSvn(string startDateTime, string endDateTime, SvnConfig server)
 {
     return GetChangeSetFromSvn(DateTime.Parse(startDateTime), DateTime.Parse(endDateTime), server);
 }