Esempio n. 1
0
        public void RunCompressHistoryTwo()
        {
            string repositoryPath = Path.Combine(TestHelper.ParentPath, "RunCompressHistoryTwo");
            string workingPath = Path.Combine(TestHelper.WorkingPath, "RunCompressHistoryTwo");

            PathHelper.DeleteDirectory(TestHelper.BackupPath);
            PathHelper.CreateDirectory(TestHelper.BackupPath);

            TestHelper.CreateAndImport(repositoryPath);
            TestHelper.CreateWorking(repositoryPath, workingPath);

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

            BackupArguments args = new BackupArguments();
            args.RepositoryRoot = TestHelper.ParentPath;
            args.BackupRoot = TestHelper.BackupPath;
            args.Compress = true;
            args.History = 2;

            Backup.Run(args);

            // simulate changes ...
            for (int i = 0; i < 11; i++)
            {
                File.AppendAllText(readmePath, "Ticks: " + DateTime.Now.Ticks + Environment.NewLine);
                TestHelper.CommitWorking(workingPath);
                Backup.Run(args);
            }
        }
Esempio n. 2
0
        public void RunHistoryTen()
        {
            string repositoryPath = Path.Combine(TestHelper.ParentPath, "RunHistoryTen");
            string workingPath    = Path.Combine(TestHelper.WorkingPath, "RunHistoryTen");

            PathHelper.DeleteDirectory(TestHelper.BackupPath);
            PathHelper.CreateDirectory(TestHelper.BackupPath);

            TestHelper.CreateAndImport(repositoryPath);
            TestHelper.CreateWorking(repositoryPath, workingPath);

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

            BackupArguments args = new BackupArguments();

            args.RepositoryRoot = TestHelper.ParentPath;
            args.BackupRoot     = TestHelper.BackupPath;
            args.Compress       = false;
            args.History        = 10;

            Backup.Run(args);

            // simulate changes ...
            for (int i = 0; i < 11; i++)
            {
                File.AppendAllText(readmePath, "Ticks: " + DateTime.Now.Ticks + Environment.NewLine);
                TestHelper.CommitWorking(workingPath);
                Backup.Run(args);
            }
        }
Esempio n. 3
0
        static int Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            if (Parser.ParseHelp(args))
            {
                OutputHeader();
                OutputUsageHelp();
                return(0);
            }

            StringBuilder   errorBuffer = new StringBuilder();
            BackupArguments arguments   = new BackupArguments();

            if (!Parser.ParseArguments(args, arguments, s => errorBuffer.AppendLine(s)))
            {
                OutputHeader();
                Console.Error.WriteLine(errorBuffer.ToString());
                OutputUsageHelp();
                return(1);
            }

            try
            {
                Backup.Run(arguments);
            }
            catch (Exception ex)
            {
                SendErrorEmail(ex);
                return(1);
            }


            return(0);
        }
Esempio n. 4
0
        static int Main(string[] args)
        {
            if (Parser.ParseHelp(args))
            {
                OutputHeader();
                OutputUsageHelp();
                return(0);
            }

            StringBuilder   errorBuffer = new StringBuilder();
            BackupArguments arguments   = new BackupArguments();

            if (!Parser.ParseArguments(args, arguments, s => errorBuffer.AppendLine(s)))
            {
                OutputHeader();
                Console.Error.WriteLine(errorBuffer.ToString());
                OutputUsageHelp();
                return(1);
            }

            Backup.Run(arguments);

            return(0);
        }