Esempio n. 1
0
        /// <summary>
        /// Returns a VersionData that contains only those children contained in a changelog
        /// </summary>
        /// <param name="changelog"></param>
        /// <param name="prefix"></param>
        /// <returns></returns>
        public VersionData Trim(Changelog changelog, string prefix = "")
        {
            if (Filetype != FileType.Directory)
            {
                throw new InvalidOperationException("Trim cannot operate on a FileType.File");
            }
            var vdcollection = new VDKeyedCollection();

            foreach (var vd in children)
            {
                string fpath = PrefixFilename(prefix, vd.Filename);
                if (changelog.Added.ContainsKey(fpath) || changelog.Modified.ContainsKey(fpath))
                {
                    if (vd.Filetype == FileType.Directory)
                    {
                        vdcollection.Add(vd.Trim(changelog, fpath));
                    }
                    else
                    {
                        vdcollection.Add(new VersionData(vd.Filename, vd.Data));
                    }
                }
            }
            return(new VersionData(Filename, vdcollection));
        }
Esempio n. 2
0
 public Commit(Commit parent, Changelog changelog, Version version, Metadata metadata, string hash)
 {
     parents        = parent != null? new Commit[] { parent } : new Commit[0];
     this.changelog = changelog;
     this.metadata  = metadata;
     this.version   = version;
     commitHash     = hash;
 }
Esempio n. 3
0
 public Commit(Commit parent, Changelog changelog, Version version, Metadata metadata)
 {
     parents        = new Commit[] { parent };
     this.changelog = changelog;
     this.metadata  = metadata;
     this.version   = version;
     commitHash     = GenerateHash();
 }
Esempio n. 4
0
 public Commit(Commit[] parents, Changelog changelog, Version version, Metadata metadata, string hash)
 {
     this.parents   = parents;
     this.changelog = changelog;
     this.metadata  = metadata;
     this.version   = version;
     commitHash     = hash;
 }
Esempio n. 5
0
 public Commit(Commit[] parents, Changelog changelog, Version version, Metadata metadata)
 {
     this.parents   = parents;
     this.changelog = changelog;
     this.metadata  = metadata;
     this.version   = version;
     commitHash     = GenerateHash();
 }
Esempio n. 6
0
 /// <summary>
 /// Constructs a Version object from the specified hash, and stores proxies with a changelog dependency
 /// </summary>
 /// <param name="hash"></param>
 /// <param name="changelog"></param>
 /// <returns></returns>
 public Version GetVersion(string hash, Changelog changelog)
 {
     return(directory.GetVersion(hash, changelog));
 }
Esempio n. 7
0
 /// <summary>
 /// Deletes a Changelog from the file directory
 /// </summary>
 /// <param name="changelog"></param>
 public void DeleteChangelog(Changelog changelog)
 {
     directory.DeleteChangelog(changelog);
 }
Esempio n. 8
0
 /// <summary>
 /// Saves a Changelog to the file directory
 /// </summary>
 /// <param name="changelog"></param>
 public void CreateChangelog(Changelog changelog)
 {
     directory.CreateChangelog(changelog);
 }
Esempio n. 9
0
 public DiffChangelog(Changelog first, Changelog second)
 {
     DiffInit(new Changelog[] { first, second });
 }
Esempio n. 10
0
 public Build(Build parent, Changelog changelog, Version version, BuildMetadata metadata)
     : base(parent, changelog, version, metadata)
 {
 }
Esempio n. 11
0
 public Build(Build parent, Changelog changelog, Version version, BuildMetadata metadata, string hash)
     : base(parent, changelog, version, metadata, hash)
 {
 }
Esempio n. 12
0
        /// <summary>
        /// Returns a subset of this Version that contains only VersionData contained in changelog
        /// </summary>
        /// <param name="changelog"></param>
        /// <returns></returns>
        public Version GetChangelogVersion(Changelog changelog)
        {
            var vd = data.Trim(changelog);

            return(new Version(vd, vd.Hash));
        }