Try to resolve the issue with JetBrains computer names in TFS workspaces#212
Try to resolve the issue with JetBrains computer names in TFS workspaces#212AlexRukhlin wants to merge 3 commits intomasterfrom
Conversation
| try { | ||
| workspaceInfo = determineCachedWorkspaceImpl(pathFreeArguments, ignoreWorkspaceOptionValue); | ||
|
|
||
| if (LocalHost.getShortName().equalsIgnoreCase(workspaceInfo.getComputer())) { |
There was a problem hiding this comment.
I don't understand the need for the comparison here. If the workspace was found, shouldn't we just return it?
There was a problem hiding this comment.
IMO, we do not check the computer when trying to find a workspace in the cache. If we've found a workspace with an unexpected computer name, I would change the name (by using the system property) and continue with that. I hope that would protect us from unexpected cache refresh, which might remove the workspace.
| jbComputerName)); | ||
|
|
||
| System.setProperty(LocalHost.SHORT_NAME_OVERRIDE_PROPERTY, jbComputerName); | ||
| return determineCachedWorkspaceImpl(pathFreeArguments, ignoreWorkspaceOptionValue); |
There was a problem hiding this comment.
If this final attempt using the JetBrains computer name is unsuccessful, should we set the system property back to its original value?
|
|
||
| final String jbComputerName = LocalHost.getShortNameJB(); | ||
| log.info(MessageFormat.format( | ||
| "We'll try to find the workspace one more time using the JetBrains name {0}", //$NON-NLS-1$ |
There was a problem hiding this comment.
P999: "JetBrains name" would be clearer as: "JetBrains computer name"
jpricket
left a comment
There was a problem hiding this comment.
The changes seem good to me. I had one question, but I trust that the code is correct.
Leah should probably also review them.
| name.substring(0, (name.length() > MAX_COMPUTER_NAME_SIZE) ? MAX_COMPUTER_NAME_SIZE : name.length()); | ||
| } | ||
|
|
||
| log.info("Short name resolved to: " + computerNameJB); //$NON-NLS-1$ |
There was a problem hiding this comment.
Should this be computerName not computerNameJB?
| * @return a short identifier (name of this computer). Never | ||
| * <code>null</code> or empty. | ||
| */ | ||
| public synchronized static String getShortNameJB() { |
There was a problem hiding this comment.
Use the same way to figure out the short name like JetBrains
https://github.com/JetBrains/tfsIntegration/blob/0f127c1b10acd3f985920246f43dfbe170d69960/src/org/jetbrains/tfsIntegration/core/tfs/Workstation.java#L234
leantk
left a comment
There was a problem hiding this comment.
I verified this worked on my Mac
|
I' seeing an issue with the workspaces command though. Investigating now... |
No description provided.