예제 #1
0
        public static void Init(string path)
        {
            Directory.CreateDirectory(SysIO.Path.Combine(path, "temp"));
            Directory.CreateDirectory(SysIO.Path.Combine(path, "data"));
            Directory.CreateDirectory(SysIO.Path.Combine(path, "heads"));

            var rep = new ZipBackupRepository(path);

            using (var proto = rep.CreateBackup ())
            {

                proto.SetDescription("Init");

                proto.Save ();

                rep.AddHead("HEAD", proto.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 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);
        }