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 void RollbackLastChange() { VCSChange change = changes.Pop(); change.RollbackPatch.Apply(latestVersion); }