Example #1
0
        private void resolveParentNotFoundConflictForFolder(ChangeGroup group, Change change)
        {
            //We have to query the list of all files based on the branch source.
            //Subversion only pends one recursive branch action rather than a action for all files
            //Therefore we have to resolve this list manually
            var items = CurrentRepository.GetItems(change.FullServerPath, change.Changeset.Revision, true);

            //pend an action for every single item
            //We do not have to handle the root folder individually since it is one item in the collection already
            foreach (var sourceItem in items)
            {
                var migrationItem = new SubversionMigrationItem(sourceItem, change.Changeset.Revision);

                group.CreateAction(WellKnownChangeActionId.Add,
                                   migrationItem,
                                   null,
                                   sourceItem.Path,
                                   null,
                                   null,
                                   sourceItem.ItemType.ReferenceName,
                                   null);

                //There might be subsequent delete operations that could be pending due to rename or move operations.
                //Therefore we have to check the delete table for every single file and folder and drop it if needed
                DropNotNeededDeleteActions(sourceItem.FullServerPath);
            }
        }
        /// <summary>
        /// Deserializes the itemblob to a actual instance of an <see cref="IMigrationItem"/> object
        /// </summary>
        /// <param name="itemBlob">The string representation of the object that has to be deserialized</param>
        /// <param name="manager"></param>
        /// <returns>Returns a new instance of the deserialized object</returns>
        public IMigrationItem LoadItem(string itemBlob, ChangeGroupManager manager)
        {
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            if (string.IsNullOrEmpty(itemBlob))
            {
                throw new ArgumentNullException("itemBlob");
            }

            XmlSerializer serializer = new XmlSerializer(typeof(SubversionMigrationItem));

            using (StringReader strReader = new StringReader(itemBlob))
                using (XmlReader xmlReader = XmlReader.Create(strReader))
                {
                    SubversionMigrationItem item = (SubversionMigrationItem)serializer.Deserialize(xmlReader);
                    return(item);
                }
        }
Example #3
0
        private void ProcessFolderBranch(Change change, ChangeGroup group)
        {
            var        sourceBaseUri      = change.CopyFromFullServerPath;
            var        destinationBaseUri = change.FullServerPath;
            var        repositoryUri      = new Uri(change.Changeset.Repository);
            Repository repository         = Repository.GetRepository(repositoryUri);

            //We have to query the list of all files based on the branch source.
            //Subversion only pends one recursive branch action rather than a action for all files
            //Therefore we have to resolve this list manually

            var items = repository.GetItems(change.CopyFromFullServerPath, change.CopyFromRevision, true);

            //pend an action for every single item
            //We do not have to handle the root folder individually since it is one item in the collection already
            //we do not have to cover the branch | edit case either because there is an additional record in the changelist alredy
            foreach (var sourceItem in items)
            {
                var destinationUri = PathUtils.RebaseUri(new Uri(sourceItem.FullServerPath),
                                                         new Uri(sourceBaseUri),
                                                         new Uri(destinationBaseUri));

                var destinationPath = PathUtils.ExtractPath(repositoryUri, destinationUri);

                var migrationItem = new SubversionMigrationItem(repositoryUri,
                                                                destinationUri,
                                                                change.Changeset.Revision,
                                                                sourceItem.ItemType);

                group.CreateAction(WellKnownChangeActionId.Branch,
                                   migrationItem,
                                   sourceItem.Path,
                                   destinationPath.OriginalString,
                                   change.CopyFromRevision.ToString(),
                                   null,
                                   change.ItemType.ReferenceName,
                                   null);
            }
        }