示例#1
0
        public void AddNewVersion(VCSCommit parentCommit, byte[] newData)
        {
            // First remove all changes for this file in the parent commit, if any.
            foreach (var otherChange in from ch in parentCommit.Changes where ch.ParentFile == this select ch)
            {
                parentCommit.Changes.Remove(otherChange);
            }

            // Add this change to the parent commit and to the list of local changes.
            var change = new VCSChange(parentCommit, this, new XDeltaPatch(source: latestVersion, target: newData));

            changes.Push(change);
            parentCommit.Changes.Add(change);

            // Update the latest version to this new data.
            latestVersion = newData;
        }
 public VCSChange(SerializationInfo info, StreamingContext context)
 {
     RollbackPatch = (XDeltaPatch)info.GetValue(nameof(RollbackPatch), typeof(XDeltaPatch));
     ParentCommit  = (VCSCommit)info.GetValue(nameof(ParentCommit), typeof(VCSCommit));
     ParentFile    = (NDSFile)info.GetValue(nameof(ParentFile), typeof(NDSFile));
 }
 public VCSChange(VCSCommit parentCommit, NDSFile parentFile, XDeltaPatch rollbackPatch)
 {
     RollbackPatch = rollbackPatch;
     ParentCommit  = parentCommit;
     ParentFile    = parentFile;
 }