Esempio n. 1
0
        public override async Task Setup()
        {
            Process          svnAdmin;
            ProcessStartInfo info;

            // Generate directories and a svn util.
            LocalPath = new FilePath(FileService.CreateTempDirectory() + Path.DirectorySeparatorChar);

            // Create repo in "repo".
            svnAdmin           = new Process();
            info               = new ProcessStartInfo();
            info.FileName      = File.Exists(MacSvnAdminPath) ? MacSvnAdminPath : "svnadmin";
            info.Arguments     = "create " + RemotePath.Combine("repo");
            info.WindowStyle   = ProcessWindowStyle.Hidden;
            svnAdmin.StartInfo = info;
            svnAdmin.Start();
            svnAdmin.WaitForExit();

            // Create host (Win32)
            // This needs to be done after doing the svnAdmin creation.
            // And before checkout.
            if (SvnServe != null)
            {
                info               = new ProcessStartInfo();
                info.FileName      = "svnserve";
                info.Arguments     = "-dr " + RemotePath;
                info.WindowStyle   = ProcessWindowStyle.Hidden;
                SvnServe.StartInfo = info;
                SvnServe.Start();

                // Create user to auth.
                using (var perm = File.CreateText(RemotePath.Combine("repo", "conf", "svnserve.conf"))) {
                    perm.WriteLine("[general]");
                    perm.WriteLine("anon-access = write");
                    perm.WriteLine("[sasl]");
                }
            }

            // Check out the repository.
            await CheckoutAsync(LocalPath, RemoteUrl);

            Repo   = GetRepo(LocalPath, RemoteUrl);
            DotDir = ".svn";

            await base.Setup();
        }