Exemplo 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));
        }
Exemplo 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;
 }
Exemplo 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();
 }
Exemplo 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;
 }
Exemplo 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();
 }
Exemplo 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));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Deletes a Changelog from the file directory
 /// </summary>
 /// <param name="changelog"></param>
 public void DeleteChangelog(Changelog changelog)
 {
     directory.DeleteChangelog(changelog);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Saves a Changelog to the file directory
 /// </summary>
 /// <param name="changelog"></param>
 public void CreateChangelog(Changelog changelog)
 {
     directory.CreateChangelog(changelog);
 }
Exemplo n.º 9
0
 public DiffChangelog(Changelog first, Changelog second)
 {
     DiffInit(new Changelog[] { first, second });
 }
Exemplo n.º 10
0
 public Build(Build parent, Changelog changelog, Version version, BuildMetadata metadata)
     : base(parent, changelog, version, metadata)
 {
 }
Exemplo n.º 11
0
 public Build(Build parent, Changelog changelog, Version version, BuildMetadata metadata, string hash)
     : base(parent, changelog, version, metadata, hash)
 {
 }
Exemplo 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));
        }