-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Enable navigation from historical file to solution #1783
Enable navigation from historical file to solution #1783
Conversation
Extend the GoToSolutionOrPullRequestFile command to support navigation from a file opened using the history view to the same file in the users solution/working directory.
| var match = tempFileObjectishRegex.Match(tempFile); | ||
| if (match.Success) | ||
| { | ||
| return match.Groups["objectish"].Value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you name the group objectish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's not you, that's just what the value is called in RepoExtensions.Lookup(...). Nvm me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(first 8 chars of a blob SHA) ahh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It started off being called blobish, but I stole the name from the Lookup method you found. 😄
| foreach (var commit in repo.Commits) | ||
| { | ||
| var trees = new Stack<Tree>(); | ||
| trees.Push(commit.Tree); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now know what a Git blob sha is, I've yet to wrap my head around a Commit Tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to read the tests more
StanleyGoldman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something small to refactor..
| if (objectish == null) | ||
| { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first three if statements from this function and the function above are meant to be the same.
The only minor minor difference (took me a moment to spot) is you are saving the repository dir in the second implementation.
The intent might be clearer if you combine both to one function that returns repositoryDir if the conditions are right or null if they fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetRepositoryDirectoryForSourceViewAndPath or something..
|
Everything works here. Just one thing that can be clarified i spotted. |
Factored out FindObjectishForTFSTempFile and added comments.
What this PR does
Extend the
GoToSolutionOrPullRequestFilecommand to support navigation from a file opened using the history view to the same file in the users solution/working directory.How to test
The history of a file
Right click on a source file from a repository and

Code context > View History...Double click on a revision in the history

Right click on the read-only historical file and

Open File in SolutionIt should navigate to the equivalent position in your solution / working directory
The commit history
Select

View History...from the status barDouble click on a commit in the history

Double click on a changed file in the commit

Right click on the commit diff view and

Open File in SolutionIt should navigate to the equivalent position in your solution / working directory