コード例 #1
0
        /// <summary>
        /// Creates map of changes from old ID to new ID given the two snapshot IDs
        /// </summary>
        /// <param name="source">Source snapshot ID</param>
        /// <param name="destination">Destination snapshot ID</param>
        /// <returns>Dictionary mapping (old Id -> new Id)</returns>
        public Dictionary <Guid, Guid> ChangesBetween(Guid source, Guid destination)
        {
            var snapshots = snapshotsService.SnapshotsBetweenReverse(source, destination);

            Dictionary <Guid, Guid> changes = new Dictionary <Guid, Guid>();

            foreach (var snapshotId in snapshots)
            {
                // Skip changes that lead to the source
                if (snapshotId != source)
                {
                    if (changeSetProvider.ContainsSnapshot(snapshotId))
                    {
//#if DEBUG
//                        Debug.WriteLine("Changes for snapshot " + snapshotId);
//                        using (var change = changeSetProvider.GetChangeSetEdges(snapshotId))
//                        {
//                            while (change.MoveNext())
//                            {
//                                Debug.WriteLine(change.Current.Data.Data.ToString() + " -> " + change.Current.ToNodeId);
//                            }
//                        }
//#endif

                        using (var change = changeSetProvider.GetChangeSetEdges(snapshotId))
                        {
                            AppendChange(change, changes);
                        }
                    }
                    else
                    {
                        throw new InvalidOperationException("There is no commit history for given snapshot");
                    }
                }
            }

            return(changes);
        }