Inheritance: IBranch
コード例 #1
0
ファイル: Repository.cs プロジェクト: openhome/ohGit
        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);
        }
コード例 #2
0
ファイル: Repository.cs プロジェクト: openhome/ohGit
        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));
        }
コード例 #3
0
ファイル: Change.cs プロジェクト: openhome/ohGit
        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);
            }
        }