diff --git a/uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs b/uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs index 70bc6e87..d8086fa0 100644 --- a/uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs +++ b/uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs @@ -266,7 +266,10 @@ protected override IReadOnlyList GetMergedItems(string[] folder } if (renames.Any()) - results.AddRange(renames); + { + results.RemoveAll(x => renames.Any(r => r.Key == x.Key)); + results.AddRange(renames); + } return results; } diff --git a/uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs b/uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs index 722250a0..fc4a27cd 100644 --- a/uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs +++ b/uSync.BackOffice/SyncHandlers/SyncHandlerRoot.cs @@ -263,6 +263,8 @@ public IEnumerable ImportAll(string folder, HandlerSettings config, /// public IEnumerable ImportAll(string[] folders, HandlerSettings config, uSyncImportOptions options) { + logger.LogDebug("ImportAll: {handlerType} STARTING", handlerType); + var cacheKey = PrepCaches(); runtimeCache.ClearByKey(cacheKey); @@ -280,6 +282,8 @@ public IEnumerable ImportAll(string[] folders, HandlerSettings conf int count = 0; int total = items.Count; + logger.LogDebug("ImportAll: {handlerType} {count} items", handlerType, total); + foreach (var item in items) { count++; @@ -296,7 +300,7 @@ public IEnumerable ImportAll(string[] folders, HandlerSettings conf { cleanMarkers.Add(item.Path); } - else if (attempt.Item is not null && attempt.Item is TObject update) + else if (attempt.Item is not null && attempt.Item is TObject update && attempt.Change != ChangeType.Hidden) { updates.Add(new ImportedItem(item.Node,update)); } @@ -318,14 +322,17 @@ public IEnumerable ImportAll(string[] folders, HandlerSettings conf serializer.Save(updates.Select(x => x.Item)); } + logger.LogDebug("ImportAll: Second Pass: {handlerType} {updates}", handlerType, updates.Count); PerformSecondPassImports(updates, actions, config, options.Callbacks?.Update); } if (actions.All(x => x.Success) && cleanMarkers.Count > 0) { + logger.LogDebug("ImportAll: Clean: {handlerType} {cleans}", handlerType, cleanMarkers.Count); PerformImportClean(cleanMarkers, actions, config, options.Callbacks?.Update); } + logger.LogDebug("ImportAll: {handlerType} DONE", handlerType); CleanCaches(cacheKey); options.Callbacks?.Update?.Invoke("Done", 3, 3); @@ -534,6 +541,8 @@ virtual public IEnumerable ImportElement(XElement node, string file var serializerOptions = new SyncSerializerOptions(options.Flags, settings.Settings, options.UserId); serializerOptions.MergeSettings(options.Settings); + logger.LogDebug("ImportElement: {alias} {path} {filename}", node.GetAlias(), node.GetPath(), shortFilename); + // get the item. var attempt = DeserializeItem(node, serializerOptions); var action = uSyncActionHelper.SetAction(attempt, GetNameFromFileOrNode(shortFilename, node), node.GetKey(), this.Alias, IsTwoPass);