Skip to content
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

RevFileTree: Blame instead of View #9424

Merged

Conversation

gerhardol
Copy link
Member

@gerhardol gerhardol commented Jul 28, 2021

Part of #7598
Closes #9435
Closes #9437

Proposed changes

  • RevFileTree: Blame instead of View
    Show blame for object type blobs (files), as is available in FileHistory.
    Note that object type commit (submodules) are shown as text, as before.
    It is possible to toggle the view to show file contents, as before.

In FileHistory the commit info is available in a header. This is excluded in RevFileTree. The info for the selected commit can be seen in Commit, Diff tabs, overview is available in tooltip for otyher commits.
This could be configurable.

  • RevDiff: HotKey to view FileTree
    A menu command existed to view the file, this as a hotkey.

Note that T was selected as key, F is to be used to add the filepath to the Advanced filter in the grid.

  • RevDiff: B to view Blame instead of Diff
    Note that this is just for the current file, selecting another (or the same) file will show Diff by default.
    For artificial, HEAD is blamed, worktree/index changes cannot be shown

  • When blaming in RevDiff or FileTree, select the current line in fileviewer in Blame (especially useful in RevDiff)

  • Cancellation support in LoadBlame() (in between operations, not in methods)

Screenshots

Before

image

For reference - FileHistory Blame tab, unchanged by this PR
image

(RevDiff B opened FileHistory in a new instance, no screenshot.)

After

image

Only the hotkey added
image

Context menu and hotkey B toggle Diff/Blame.

image

Test methodology

Manual


✒️ I contribute this code under The Developer Certificate of Origin.

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Feels quite natural.

Wishes for this PR:

Wishes for later:

GitUI/CommandsDialogs/FormBrowse.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/RevisionFileTreeControl.Designer.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/RevisionFileTreeControl.cs Outdated Show resolved Hide resolved
@gerhardol
Copy link
Member Author

gerhardol commented Aug 1, 2021

Wishes for this PR:

Most of these are for BlameControl should be a separate issue (#7598 is quite confusing as is...)
Improvements are necessary.

Also if Blame is improved, there may be need for a configurable way to show Blame/View (or even Blame/Diff).
Some discussions in #7598, this is a first implementation to fond what is really needed.

Edit: The blame/view context menu control could be added to this or if requested, if that is considered a longer term solution.

@gerhardol
Copy link
Member Author

Converted this to a draft and based it on #9425 (approved, to be merged soon) and #9426 as there are some functionality required.
The commits from 7037db2 RevFileTree: Blame instead of View to 1c921d7 fixup! RevFileTree: Blame instead of View are unchanged.

Some new additions:

  • flicker selecting is removed in c7f0165 fixup! avoid flicker switching files
  • The existing issue is removed 58e63c0 Blame; Hide EnableAutomaticContinuousScroll
  • To avoid that slow blame is a blocker, it is possible to View files as before.
    The shortcut key B is used to toggle View/Blame instead of opening a new instance. (the value is stored in settings.
    Note: a similar change should be added to RevDiff, B to Blame files.

@gerhardol gerhardol force-pushed the feature/i7598-filetree-blame branch 2 times, most recently from 390b8fa to 34691dc Compare August 8, 2021 22:44
@gerhardol gerhardol marked this pull request as ready for review August 8, 2021 22:57
@gerhardol
Copy link
Member Author

Cleaned up commits a little, adding RevDiff Blame
Ready for review again
Further changes are presented in #9445

@RussKie RussKie self-requested a review August 9, 2021 01:07
Copy link
Collaborator

@GintasS GintasS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrote a few comments regarding style basically.

@gerhardol gerhardol force-pushed the feature/i7598-filetree-blame branch from 00f6da8 to 16b7ec4 Compare August 9, 2021 19:36
@gerhardol
Copy link
Member Author

Rebased on master to resolve MC (and master eeb8f67 is unusable, fixed in adbb410).
Also squashed the NRT in #9424 (comment)

Copy link
Member

@mstv mstv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

this.BlameControl.Margin = new System.Windows.Forms.Padding(0);
this.BlameControl.Name = "blameControl";
this.BlameControl.Size = new System.Drawing.Size(487, 303);
this.BlameControl.TabIndex = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflict with FileText.TabIndex (although they are not displayed at the same time).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was intentional, really a need to separate them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general rule: no item should have identical indices. Though this is the keyboard tab order, i.e. used when tab between controls. Accessibility tools don't use it (AFAIK), and use the order in which controls are added into respective parents instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you request to change this?

@gerhardol
Copy link
Member Author

Rebased without changes, to simplify reviews and get the build successful

@@ -51,26 +51,29 @@ public partial class RevisionFileTreeControl : GitModuleControl
private readonly Stack<string> _lastSelectedNodes = new();
private readonly IRevisionFileTreeController _revisionFileTreeController;
private readonly IFullPathResolver _fullPathResolver;
private readonly IFindFilePredicateProvider _findFilePredicateProvider;
private readonly IFindFilePredicateProvider _findFilePredicateProvider = new FindFilePredicateProvider();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary for this PR, it was a change I had done (and believe should be changed) that was refactored to a separate commit

GitUI/CommandsDialogs/RevisionDiffControl.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/RevisionFileTreeControl.cs Outdated Show resolved Hide resolved
@gerhardol
Copy link
Member Author

Added two more features:

  • When blaming in RevDiff or FileTree, select the current line in fileviewer in Blame (especially useful in RevDiff)
  • Cancellation support in LoadBlame() (in between operations, not in methods)

{
_revisionGrid = revisionGrid;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I very much dislike this - this creates further coupling between various controls, and making it harder to reason about each individual control's functionality, and further complicating testing stories.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required for BlameControl so the same as in FormFileHistory.
You can see this as a step to remove a lot of code in GE: The follow up #9445 obsoletes FormFileHistory, so this is a step to remove a complete form.

gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Aug 31, 2021
@gerhardol
Copy link
Member Author

Rebased to resolve a merge conflict

@RussKie
Copy link
Member

RussKie commented Sep 4, 2021

I ran it locally briefly, seems to work. Need time to form a better opinion, but overall I think it is a good change.
Two things I've noticed:

  1. "Blame" isn't sticky, i.e. when change file selection the view changes to the "diff". Feels weird.
  2. Attempt to open history "feels" like it getting ignored. At least there is no immediate feedback, the new window doesn't open, or opens after a significant delay.

@gerhardol
Copy link
Member Author

1. "Blame" isn't sticky, i.e. when change file selection the view changes to the "diff". Feels weird.

Blame/View is sticky in FileTree tab.
Intentional in diff tab, I want to go to diff quickly in diff tab. This is partly as BlameControl is slower, annoying to show first then to blame.
I have used this for a month or so now, this is something I appreciate so I prefer to keep this.

2. Attempt to open history "feels" like it getting ignored. At least there is no immediate feedback, the new window doesn't open, or opens after a significant delay.

Do you mean H? That is not changed by this PR.
Or open FileTab? Open FileTree with Blame requires a little longer time to open Blame to View, That is why Blame/View is sticky, stored in settings.

@RussKie RussKie merged commit 1fd88ac into gitextensions:master Sep 5, 2021
@RussKie RussKie added this to the 3.6 milestone Sep 5, 2021
@gerhardol gerhardol deleted the feature/i7598-filetree-blame branch September 6, 2021 05:22
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Jan 7, 2022
Blame can start presenting on a line. This is is available in
RevDiff and RevFileTree since gitextensions#9424.
(Even if the code enabling this has existed for long time.)

The "goto line" was only used if the control had to be init,
not if e.g. toggling to Diff and selecting an new diff line
and then Blame again.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Jan 7, 2022
Blame can start presenting on a line. This is is available in
RevDiff and RevFileTree since gitextensions#9424.
(Even if the code enabling this has existed for long time.)

The "goto line" was only used if the control had to be init,
not if e.g. toggling to Diff and selecting an new diff line
and then Blame again.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Jan 13, 2022
Blame can start presenting on a line. This is is available in
RevDiff and RevFileTree since gitextensions#9424.
(Even if the code enabling this has existed for long time.)

The "goto line" was only used if the control had to be init,
not if e.g. toggling to Diff and selecting an new diff line
and then Blame again.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Jan 19, 2022
Blame can start presenting on a line. This is is available in
RevDiff and RevFileTree since gitextensions#9424.
(Even if the code enabling this has existed for long time.)

The "goto line" was only used if the control had to be init,
not if e.g. toggling to Diff and selecting an new diff line
and then Blame again.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Jan 22, 2022
Blame can start presenting on a line. This is is available in
RevDiff and RevFileTree since gitextensions#9424.
(Even if the code enabling this has existed for long time,
it was just used for a special case.)

The "goto line" was only used if the control had to be init,
not if e.g. toggling to Diff and selecting an new diff line
and then Blame again.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Jan 23, 2022
Blame can start presenting on a line. This is is available in
RevDiff and RevFileTree since gitextensions#9424.
(Even if the code enabling this has existed for long time,
it was just used for a special case.)

The "goto line" was only used if the control had to be init,
not if e.g. toggling to Diff and selecting an new diff line
and then Blame again.
gerhardol added a commit that referenced this pull request Jan 25, 2022
Blame can start presenting on a specific line. This is is available in
RevDiff and RevFileTree since #9424.
(Even if the code enabling this has existed for long time,
it was just used for a special case.)

The "goto line" was only used if the control had to be initialised,
not if e.g. toggling to Diff and selecting an new diff line
and then Blame again.
RussKie added a commit to RussKie/gitextensions that referenced this pull request Nov 27, 2022
"RevisionFileTreeShowBlame" settings was introduced in gitextensions#9424.

The issue with this settings is that whenever a file history is opened,
blame is turned on for all open instances of the app, and affects the
File Tree tab experience.
RussKie added a commit to RussKie/gitextensions that referenced this pull request Dec 4, 2022
"RevisionFileTreeShowBlame" settings was introduced in gitextensions#9424.

The issue with this settings is that whenever a file history is opened,
blame is turned on for all open instances of the app, and affects the
File Tree tab experience.
RussKie added a commit to RussKie/gitextensions that referenced this pull request Dec 12, 2022
"RevisionFileTreeShowBlame" settings was introduced in gitextensions#9424.

The issue with this settings is that whenever a file history is opened,
blame is turned on for all open instances of the app, and affects the
File Tree tab experience.
RussKie added a commit that referenced this pull request Dec 13, 2022
Resolves #10511

"RevisionFileTreeShowBlame" settings was introduced in #9424.

The issue with this settings is that whenever a file history is opened,
blame is turned on for all open instances of the app, and affects the
File Tree tab experience.

Co-authored-by: Gerhard Olsson <6248932+gerhardol@users.noreply.github.com>
RussKie added a commit that referenced this pull request Dec 13, 2022
Resolves #10511

"RevisionFileTreeShowBlame" settings was introduced in #9424.

The issue with this settings is that whenever a file history is opened,
blame is turned on for all open instances of the app, and affects the
File Tree tab experience.

Co-authored-by: Gerhard Olsson <6248932+gerhardol@users.noreply.github.com>
(cherry picked from commit 53d608e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve FileTree / BlameControl updates BlameControl: Hide unrelated context menu item
4 participants