コード例 #1
0
ファイル: Program.cs プロジェクト: pdelvo/GitBackup
        public void RenameHead(
            [Description("The path of the backup directory")]
            [Required]
            string backupPath,
            [Description("The name of the head")]
            [Required]
            string name,
            [Description("The new name of the head")]
            [Required]
            string newName)
        {
            var backupRepo = new ZipBackupRepository(backupPath);

            if (!backupRepo.HeadExists(name))
                throw new InvalidOperationException("The head does not exist");

            var value = backupRepo.ResolveIdentifier(name);
            backupRepo.AddHead(newName, value);
            backupRepo.RemoveHead(name);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: pdelvo/GitBackup
        public void CreateHead(
            [Description("The path of the backup directory")]
            [Required]
            string backupPath,
            [Description("The name of the head")]
            [Required]
            string name,
            [Description("The identifier the head should point to (can be a backup id or a head name)")]
            [Required]
            string identifier)
        {
            var backupRepo = new ZipBackupRepository(backupPath);

            if (backupRepo.HeadExists(name))
                throw new InvalidOperationException("The head already exists");

            backupRepo.AddHead(name, backupRepo.ResolveIdentifier(identifier));
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: pdelvo/GitBackup
        public void ListHeads(
            [Description("The path of the backup directory")]
            [Required]
            string backupPath
            )
        {
            var backupRepo = new ZipBackupRepository(backupPath);

            Console.WriteLine("Heads:");

            foreach (var head in backupRepo.GetHeads())
            {
                Console.WriteLine("{0} -> {1}", head, backupRepo.ResolveIdentifier(head));
            }
        }