コード例 #1
0
ファイル: ModelTests.cs プロジェクト: Jeffjewett27/EChest
        public void GetChangelog()
        {
            Changelog c = directory.GetChangelog("mergeOtherMain");

            Assert.IsTrue(c.Added.ContainsKey("file6.txt"));
            Assert.IsTrue(c.Modified.ContainsKey("file2.txt"));
            c.Renamed.TryGetValue("file1.txt", out string f4txt);
            Assert.AreEqual(f4txt, "file4.txt");
            Assert.IsTrue(c.Removed.Contains("file3.txt"));
        }
コード例 #2
0
        /// <summary>
        /// Converts this object to a Commit object
        /// </summary>
        /// <param name="directory">The directory dependency for proxies</param>
        /// <param name="loader">The loader object which specifies which objects to load</param>
        /// <returns></returns>
        public Commit GetCommit(DirectoryStructure directory, CommitDependencyLoader loader)
        {
            Commit[] parents = new Commit[Parents.Length];
            for (int i = 0; i < parents.Length; i++)
            {
                string p = Parents[i];
                if (loader.LoadParents && loader.ShouldLoadParent(p))
                {
                    parents[i] = directory.GetCommit(p, loader.GetParent(p));
                }
                else
                {
                    parents[i] = new CommitProxy(p, directory);
                }
            }

            Changelog changelog = loader.LoadChangelog ?
                                  directory.GetChangelog(Changelog) :
                                  new ChangelogProxy(Changelog, directory);

            Version version = loader.LoadVersion ?
                              directory.GetVersion(Hash, loader.LoadVersionData) :
                              new VersionProxy(Version, directory);

            CommitMetadata metadata = Metadata != null?Metadata.GetMetadata()
                                          : throw new FormatException("Commit must contain metadata");

            return(new Commit(parents, changelog, version, metadata, Hash));
        }
コード例 #3
0
        public Build GetBuild(DirectoryStructure directory)
        {
            var parent    = directory.GetBuild(Parent);
            var changelog = directory.GetChangelog(Changelog);
            var version   = directory.GetVersion(Version);
            var metadata  = Metadata.GetBuildMetadata();

            return(new Build(parent, changelog, version, metadata));
        }
コード例 #4
0
 /// <summary>
 /// Loads a Changelog
 /// </summary>
 /// <param name="hash">The hash of the changelog to load</param>
 /// <returns></returns>
 public Changelog GetChangelog(string hash)
 {
     return(directory.GetChangelog(hash));
 }