Skip to content

Conversation

navn-r
Copy link
Collaborator

@navn-r navn-r commented Jul 20, 2021

Added history context menu button in file browser

  • Emits a new signal in Git Model
  • Navigates to Git Panel, and switches to History Tab

Displays Single File History in History Tab

  • Clicking the Discard file history button 'reverts' the history tab back to its usual repo history
  • Each commit node is now hoverable, and on click will open the diff
  • It will not have a hover effect and will disable its hover+click functionality if the file is binary

TODO:

  • Styling: the FileItem in the history panel should be styled
  • The diff file context menu item should be available for modified file
  • Add/Update/Fix tests

Fixes #864

@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch MLH-Fellowship/jupyterlab-git/feat/selected-file-history

@fcollonval fcollonval self-requested a review July 21, 2021 09:17
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks a lot @navn-r This is great!

I commented in the code as much as possible. One UI comment - reusing the FileItem component to display the file name at the history top is a good idea. It will probably require some styling to highlight it compare to the history list (a different background color maybe).

@navn-r navn-r requested a review from fcollonval July 21, 2021 16:14
@navn-r navn-r force-pushed the feat/selected-file-history branch from d3e9338 to fb1ef73 Compare July 21, 2021 16:19
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks for quickly applying the suggestion.

Remaining points I see:

  • Styling: the FileItem in the history panel should be styled
    • to stand out of the history commit list
    • to not be hidden when the user scrolls on the commits list (maybe making it sticky would work)
    • Not applying style through the style props (see comment in code)
  • The diff file context menu item should be available for modified file (it is not currently). For such case it will be good to add a history item that allow to display uncommited changes (you can have a look at how VS Code is doing it in its timeline panel).
  • Correct the tests and add new ones

@navn-r
Copy link
Collaborator Author

navn-r commented Jul 24, 2021

Progress Update

From this recent push... (styled and sticky selected file + Uncommitted changes commit node)

image

Besides adding/fixing tests, these are the only things left, as requested by @adammclaurin:

  • Handle history edge case for Ignored files

From @fcollonval:

It maybe interesting to update the current ignored files when the filebrowser path changes (hmm some polling will probably be needed too as files can be added, renamed or deleted). Maybe listening to fileChanged and pathChanged signals can be enough

  • Select two arbitrary commits and view their diff (Select for compare & Compare with selected from VSCode)
  • Pending discussion on how to handle this Need to separate issue+PR for this

Tiny Update from me:

I figured just adding a 'no history found' default to the side bar requires less effort yet delivers the same end-user value, compared to watching for the ignored files then trying to hide the history context button.

image

@navn-r navn-r requested a review from fcollonval July 24, 2021 23:00
@fcollonval
Copy link
Member

fcollonval commented Jul 25, 2021

Thanks for the update.

Select two arbitrary commits and view their diff (Select for compare & Compare with selected from VSCode)

I would left this one out for a follow-up PR. This brings in already a big change.

For how to do it (in the single file history view), using a context menu would be nice and/or a visual check box on the commit info top right - but this maybe complex because we need to enforce two nodes selection only and there is the notion of what are the reference and challenger.

@fcollonval
Copy link
Member

I figured just adding a 'no history found' default to the side bar requires less effort yet delivers the same end-user value, compared to watching for the ignored files then trying to hide the history context button.

👍

We can open a new issue with enhancement proposal to deal with ignored files.

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Almost there @navn-r

I have some suggestions to improve readability. You need also to rebase the PR and to fix the tests.

I opened the follow-up issues: #984 and #985

@navn-r navn-r force-pushed the feat/selected-file-history branch from fe40b6a to c67ebe1 Compare July 27, 2021 13:29
@navn-r navn-r requested a review from fcollonval August 2, 2021 11:31
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks @navn-r

Could you please add a Python unit test that check the git command executed and the parsing of the output?

The best starting point for that would be to duplicate jupyterlab_git/tests/test_detailed_log.py and apply it to the single file case.

@navn-r navn-r requested a review from fcollonval August 3, 2021 12:49
@fcollonval
Copy link
Member

Thanks a lot @navn-r

@fcollonval fcollonval merged commit 02c6d9a into jupyterlab:master Aug 3, 2021
@fcollonval fcollonval deleted the feat/selected-file-history branch August 3, 2021 12:59
}
protected _getFileChangedLabel(change: keyof typeof STATUS_CODES): string {
return STATUS_CODES[change];
return STATUS_CODES[change] || 'Unmodified';
Copy link
Member

Choose a reason for hiding this comment

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

Translation missing?

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @krassowski

@fcollonval fcollonval mentioned this pull request Sep 1, 2021
2 tasks
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.

Git history for a selected file
3 participants