Inheritance: IBranch
Example #1
0
        internal IBranch CreateBranch(string aName, string aId)
        {
            String path = Path.Combine(iFolderHeads.FullName, aName);

            if (File.Exists(path))
            {
                throw (new GitException("Branch already exists"));
            }

            var file = new FileStream(path, FileMode.CreateNew, FileAccess.Write);

            using (var writer = new StreamWriter(file))
            {
                writer.Write(aId + "\n");
            }

            FileInfo info = new FileInfo(path);

            Branch branch = new Branch(new BranchFile(this, info));

            iBranches.Add(aName, branch);

            return (branch);
        }
Example #2
0
        internal void UpdateBranch(Branch aBranch, string aId)
        {
            string path = Path.Combine(iFolderHeads.FullName, aBranch.Name);

            FileInfo info = new FileInfo(path);

            var file = info.Create();

            using (var writer = new StreamWriter(file))
            {
                writer.Write(aId + "\n");
            }

            aBranch.Update(new BranchFile(this, info));
        }
Example #3
0
        internal Change(Repository aRepository, Branch aBranch)
        {
            iRepository = aRepository;
            iBranch = aBranch;
            iParents = new List<IBranch>();
            iParents.Add(iBranch);
            iWritten = false;

            if (iBranch.IsEmpty)
            {
                iRoot = new TreeModifiable(iRepository, iBranch.Commit.Tree);
            }
            else
            {
                iRoot = new TreeModifiable(iRepository, null);
            }
        }