-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor StringManipulator tool so it works just with string and not …
…work item field (#2548) This should fix #2538 As mention id that bug report, custom user mapping is not applied during migration. @LudekStipal pointed to the code it was responsible for this. The problem is not the `StringManipulatorTool` itself, but the value which is used in that branch of code. The user mapping and all the other field mapping is done using `oldWorkItem` object, which is of type `Field`. But that specific branch for strings was processed using `oldWorkItemData` object which is of type `FieldItem`. So **it is the different object** and for user fields, it is not working with mapped user names, because the are mapped in the other place. This is at least a bug for user fields which are mapped as @LudekStipal found. But I think, that is is also a potential source of bugs in the future, if something will be changing here. Because the one who will be changing something here may not notice, that populating work item fields it is done in different way for the strings. `StringManipulatorTool` was working with `FieldItem` type. At first, I wanted to change it to work with `Field` type, so it would work the same way as user mapping. But this is not possible, because `Field` type is from TFS client library, but `StringManipulatorTool` in in different (lower level) assembly where this is not accessible. So I changes `StringManipulatorTool` that it does not take a whole field as argument, but just a string and returns new string. Basically, it does what it name suggests – takes a plain string, manipulates it and returns a new string. It was used only in this one place. This may be a breaking change. The potential problem may be, than `FieldItem` was modified by `StringManipulatorTool` until now and now it remains the same. I am not sure if this can be a real issue.
- Loading branch information
Showing
5 changed files
with
135 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 2 additions & 9 deletions
11
src/MigrationTools.Shadows/Tools/MockStringManipulatorTool.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 2 additions & 8 deletions
10
src/MigrationTools/Tools/Interfaces/IStringManipulatorTool.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using MigrationTools.DataContracts; | ||
using MigrationTools.Processors.Infrastructure; | ||
|
||
namespace MigrationTools.Tools.Interfaces | ||
namespace MigrationTools.Tools.Interfaces | ||
{ | ||
public interface IStringManipulatorTool | ||
{ | ||
void ProcessorExecutionWithFieldItem(IProcessor processor, FieldItem fieldItem); | ||
string? ProcessString(string? value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters