Esempio n. 1
0
        public void Create(SandBoxRepository type, bool useTrunk)
        {
            _repositoryUri = CreateRepository(type);

            _uri = _repositoryUri;

            if (useTrunk)
            {
                switch (type)
                {
                case SandBoxRepository.Default:
                case SandBoxRepository.DefaultBranched:
                case SandBoxRepository.MergeScenario:
                case SandBoxRepository.AnkhSvnCases:
                case SandBoxRepository.Greek:
                    _uri = new Uri(_repositoryUri, "trunk/");
                    break;
                }
            }

            using (SvnClient cl = new SvnClient())
            {
                cl.UseDefaultConfiguration(); // Don't load config

                cl.CheckOut(_uri, Wc);
            }
        }
Esempio n. 2
0
 public void Create(SandBoxRepository type)
 {
     Create(type, true);
 }
Esempio n. 3
0
        public Uri CreateRepository(SandBoxRepository type)
        {
            string dir = GetTempDir("repos");

            using (SvnRepositoryClient rc = new SvnRepositoryClient())
            {
                rc.UseDefaultConfiguration(); // Don't load config

                SvnCreateRepositoryArgs cra = new SvnCreateRepositoryArgs();

                if (type == SandBoxRepository.EmptyNoMerge)
                {
                    cra.RepositoryCompatibility = SvnRepositoryCompatibility.Subversion14;
                }
                rc.CreateRepository(dir, cra);

                Uri uri = SvnTools.LocalPathToUri(dir, false);

                switch (type)
                {
                case SandBoxRepository.Empty:
                    break;

                case SandBoxRepository.Default:
                case SandBoxRepository.DefaultBranched:
                    SvnRepositoryOperationArgs ra = new SvnRepositoryOperationArgs();
                    ra.LogMessage = "r1";
                    using (SvnMultiCommandClient mucc = new SvnMultiCommandClient(uri, ra))
                    {
                        mucc.CreateDirectory("trunk");
                        mucc.CreateDirectory("trunk/src");
                        mucc.CreateDirectory("branches");
                        mucc.CreateDirectory("branches/A");
                        mucc.CreateDirectory("branches/B");
                        mucc.CreateFile("trunk/README.txt", new MemoryStream(Encoding.UTF8.GetBytes("Read me, please?\n")));
                        mucc.CreateFile("trunk/src/file1.cs", new MemoryStream(Encoding.UTF8.GetBytes("using SharpSvn;\n")));
                        mucc.CreateFile("trunk/src/file2.vb", new MemoryStream(Encoding.UTF8.GetBytes("Imports SharpSvn;\n")));
                        mucc.CreateFile("trunk/src/file3.cpp", new MemoryStream(Encoding.UTF8.GetBytes("using namespace SharpSvn;\n")));
                        mucc.SetProperty("trunk/src/file3.cpp", SvnPropertyNames.SvnEolStyle, "native");
                        mucc.CreateFile("trunk/src/file4.fs", new MemoryStream(Encoding.UTF8.GetBytes("namespace SharpSvn\n")));
                        mucc.SetProperty("trunk/src/file4.fs", SvnPropertyNames.SvnEolStyle, "LF");

                        mucc.Commit();
                    }
                    if (type == SandBoxRepository.Default)
                    {
                        break;
                    }
                    ra.LogMessage = "r2";
                    using (SvnMultiCommandClient mucc = new SvnMultiCommandClient(uri, ra))
                    {
                        mucc.CreateDirectory("branches/C");
                        mucc.Copy("trunk", "branches/trunk-r1");
                        mucc.UpdateFile("trunk/README.txt", new MemoryStream(Encoding.UTF8.GetBytes("Read me, please?\n\"Ok, read!\"\n")));

                        mucc.Commit();
                    }
                    ra.LogMessage = "r3";
                    using (SvnMultiCommandClient mucc = new SvnMultiCommandClient(uri, ra))
                    {
                        mucc.CreateDirectory("branches/D");
                        mucc.Copy("trunk", "branches/trunk-r2");
                        mucc.UpdateFile("trunk/README.txt", new MemoryStream(Encoding.UTF8.GetBytes("Read me, please?\n\"Ok, read!\"\n")));

                        mucc.Commit();
                    }
                    ra.LogMessage = "r4";
                    using (SvnMultiCommandClient mucc = new SvnMultiCommandClient(uri, ra))
                    {
                        mucc.CreateDirectory("branches/E");
                        mucc.Copy("trunk", "branches/trunk-r3");
                        mucc.UpdateFile("trunk/README.txt", new MemoryStream(Encoding.UTF8.GetBytes("Read me, please?\n\"Ok, read!\"\nNo way!\n")));

                        mucc.Commit();
                    }
                    break;

                case SandBoxRepository.MergeScenario:
                    rc.LoadRepository(dir, typeof(SvnSandBox).Assembly.GetManifestResourceStream("SharpSvn.TestBuilder.Resources.MergeScenario.repos"));
                    break;

                case SandBoxRepository.AnkhSvnCases:
                    BuildAnkhCases(uri);
                    break;

                case SandBoxRepository.Greek:
                    BuildGreek(uri);
                    break;

                default:
                    break;
                }
            }

            return(SvnTools.LocalPathToUri(dir, true));
        }