Exemple #1
0
        public static bool CreateAndImport(string repositoryPath)
        {
            CreateRepository(repositoryPath, true);

            string workingPath = Path.Combine(WorkingPath, "Create.Readme");

            PathHelper.CreateDirectory(workingPath);

            string testFile = Path.Combine(workingPath, "Readme.txt");

            File.WriteAllText(testFile, "This is a read me text file." + Environment.NewLine);

            Uri repo = new Uri(repositoryPath);

            using (var client = new SvnClient(SvnClient.Commands.Import))
            {
                client.RepositoryPath = repo.ToString();
                client.LocalPath      = workingPath;
                client.Message        = "First Import";

                var r = client.Execute();
                Console.WriteLine(client.StandardOutput);
                Console.WriteLine(client.StandardError);
                return(r);
            }
        }
Exemple #2
0
        public void Import()
        {
            string repositoryPath = Path.Combine(TestHelper.ParentPath, "SvnClientTest.Import");

            TestHelper.CreateRepository(repositoryPath, true);

            string workingPath = Path.Combine(TestHelper.WorkingPath, "Import.Test");

            PathHelper.CreateDirectory(workingPath);

            string testFile = Path.Combine(workingPath, "Readme.txt");

            File.WriteAllText(testFile, "This is a read me text file.");

            Uri repo = new Uri(repositoryPath);

            using (var client = new SvnClient(SvnClient.Commands.Import))
            {
                client.RepositoryPath = repo.ToString();
                client.LocalPath      = workingPath;
                client.Message        = "First Import";

                var result = client.Execute();

                Assert.IsTrue(result);

                Console.WriteLine(client.StandardOutput);
                Console.WriteLine(client.StandardError);
            }
        }
Exemple #3
0
        public static bool CommitWorking(string workingPath)
        {
            using (var client = new SvnClient(SvnClient.Commands.Commit))
            {
                client.LocalPath = workingPath;
                client.Message   = "Commit progress";

                var r = client.Execute();
                Console.WriteLine(client.StandardOutput);
                Console.WriteLine(client.StandardError);
                return(r);
            }
        }
Exemple #4
0
        public static bool CreateWorking(string repositoryPath, string workingPath)
        {
            PathHelper.DeleteDirectory(workingPath);
            Uri repo = new Uri(repositoryPath);

            using (var client = new SvnClient(SvnClient.Commands.Checkout))
            {
                client.RepositoryPath = repo.ToString();
                client.LocalPath      = workingPath;

                var r = client.Execute();
                Console.WriteLine(client.StandardOutput);
                Console.WriteLine(client.StandardError);
                return(r);
            }
        }
Exemple #5
0
        public void Checkout()
        {
            string workingPath = Path.Combine(TestHelper.WorkingPath, "Checkout.Test");

            PathHelper.DeleteDirectory(workingPath);

            using (var client = new SvnClient(SvnClient.Commands.Checkout))
            {
                client.RepositoryPath = TestHelper.TestRepositoryUri.ToString();
                client.LocalPath      = workingPath;

                var result = client.Execute();

                Assert.IsTrue(result);

                Console.WriteLine(client.StandardOutput);
                Console.WriteLine(client.StandardError);
            }
        }
Exemple #6
0
        private bool GetSourceInfomation(IList <SourceFile> sourceFiles, out string output)
        {
            output = string.Empty;

            // get all the svn info in one call
            SvnClient client = new SvnClient();

            CopyBuildEngine(client);

            // using target file to prevent hitting max command line lenght
            string targetFile = Path.GetTempFileName();

            try
            {
                // dumping source file list to target file
                using (var sw = File.CreateText(targetFile))
                    foreach (var sourceFile in sourceFiles)
                    {
                        // can only get info on files that exists
                        if (File.Exists(sourceFile))
                        {
                            sw.WriteLine(sourceFile);
                        }
                    }

                client.Command    = "info";
                client.TargetFile = targetFile;
                client.Xml        = true;

                client.Execute();
            }
            finally
            {
                File.Delete(targetFile);
            }

            output = client.StandardOutput;
            return(true);
        }