-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blame: Fix "blame previous revision" feature #6841
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6841 +/- ##
=========================================
+ Coverage 47.68% 47.7% +0.01%
=========================================
Files 731 731
Lines 53901 53912 +11
Branches 7073 7075 +2
=========================================
+ Hits 25703 25719 +16
- Misses 26803 26805 +2
+ Partials 1395 1388 -7
|
c61f9c5
to
abdbccf
Compare
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 lines of BlameAuthor
and BlameFile
are not aligned correctly.
Could you add the correct height calculation to this PR, please?
GitUI/UserControls/BlameControl.cs
Outdated
GitBlame blame = Module.Blame(_fileName, objectId + "^", _encoding, originalLine + ",+1"); | ||
if (blame.Lines.Count > 0) | ||
|
||
selectedRevision = _revGrid.GetRevision(objectId); |
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.
_revGrid.GetRevision
returns null
quite often. Hence the context menu items do not have an effect.
Disable the context menu items in case they will not select an other revision, on opening the context menu, please, because they do not apply at all if already at this revision or if there is no parent revision, respectively.
Best solution: All revisions are available in the RevisionGrid or loaded on demand -- never failing silently without error message.
STR:
- blame
GitUI/UserControls/BlameControl.cs
- select the revision from master 18e4485
- try to blame this or the previous revision
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.
@mstv What is STR? Has Stuttgart Airport anything to do with this?
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.
No, there's no obvious relation ;-)
STR = steps to reproduce.
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.
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.
Yes, I agree. I had understood that it will need part 2. Though in order to test the disabling of the menu items, I found it helpful to have an example where it occurs.
a487fe9
to
fa7334c
Compare
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.
Still open: The lines of BlameAuthor
and of BlameFile
are not aligned correctly.
Could you add the correct height calculation to this PR, please?
The disabling of the context menu items can be done in the second PR.
I think it would help testing the coming changes.
GitUI/UserControls/BlameControl.cs
Outdated
else | ||
_revGrid.SetSelectedRevision(revisionId); | ||
} | ||
else |
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.
nit: Our new coding style prefers early return
over else
in order to reduce nesting.
@mstv I think I have fixed most of the things related to this PR and that I won't add much. The 2 others improvements you ask we to do are not really related to the original goal of this PR just intended to fix the 'blame previous commit' feature.
Unfortunately, no 😕 for some reason :
Yes, I would like to see it fixed in another PR but I want to wait for the rename regression before working on it. So, except the last review comment, I think this PR is in good state to be merged... |
OK |
f715aa8
to
c616642
Compare
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.
LGTM. In part 2, the context menu items should be disabled if they are not applicable. This will improve the UX, especially if the file history is not complete. And it will facilitate testing the file history fix.
to select the first commit before the revision selected (so the previous, no!?!) Partly fix gitextensions#6605
to make explicit what could be done by double-clicking
c616642
to
8618125
Compare
@mstv I finally did it. |
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.
Thank you. LGTM.
@gitextensions/git-extensions-source, I am voting to include this in master now.
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.
Blame this revision is something I often missed
Agree this should go in master now and be included in 3.2
GitUI/UserControls/BlameControl.cs
Outdated
@@ -414,7 +414,18 @@ private int GetBlameLine() | |||
|
|||
private void contextMenu_Opened(object sender, EventArgs e) | |||
{ | |||
blameRevisionToolStripMenuItem.Enabled = 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.
I was confused enough to comment and would like to have a comment like
//Disable the menu entries by default
Disabling could be done in the early exit too
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 put it back in the early exit as it is equivalent and was what I did first...
Is there a way we can test it? |
Looking at the code, I don't see how to achieve it with unit tests because under the hood, it relies on With integration tests, it should be achievable (with a lot of work). |
8618125
to
7be58af
Compare
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.
Suggest merging, adding to 3.2 milestone
Partly fixes #6605 (other part will be fixed by #6807 or #6132)
Proposed changes
Fix "Blame to previous revision" behavior to select the first commit before the one introducing the changes (so the previous, no!?!) as explained in Blame previous revision without function #6605 (comment)
While I was at it, I have added a context menu item to blame selected revision to make explicit what could be done by double-clicking (because I realised with Blame view - use hash instead of timestamp #6832 (comment) that it was probably not evident for new users)
Screenshots
For the 2nd point (the 1st change nothing to the ui)
Before
Focus only on the menu (and not the colors of the lines)
After
Test methodology
Test environment(s)