Skip to content

Add popup for file history #841

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

Merged
merged 20 commits into from
Jan 30, 2022
Merged

Conversation

cruessler
Copy link
Collaborator

This adds a popup for showing the history of a single file. The PR is already in a state that should give you an idea of how the final version could look like.

There are a few issues that would need to be resolved before this can be considered ready:

  • Gathering the commit history is very slow, compared to running git log -- <path> on the command line. I will investigate and have a look at how git as well as tig do things to get an idea of how to speed things up.
  • I will manually test the new popup to make sure the history matches git log (I already have one minor discrepancy on my list).
  • commands does not return navigation commands for self.list yet.
  • When I had the commit almost prepared, I noticed that the “Log” tab shows commit details on Enter, to the right of the log. Do we want that same behaviour here?

Looking forward to your feedback!

@extrawurst extrawurst linked an issue Aug 15, 2021 that may be closed by this pull request
@extrawurst
Copy link
Collaborator

extrawurst commented Aug 15, 2021

Hi @cruessler - first of all, thanks for tackling this! The time you put into this is very appreciated!

Functionally I did not see a specific case where the history was wrong, but I did not test that very throughly yet.
Here is my list of topics I think we should tackle before merging as a MVP:

  • allowing to open the history of a file from the repo file tree view (tab 3)
  • scrollbar in the history view

In terms of post-MVP steps I find these two most important:

  • support the details side panel you mentioned above
  • use the revlog progress notifications to show a progress indicator (in percent, not in commits like in the log)

@cruessler
Copy link
Collaborator Author

@extrawurst That took longer than expected, not least due to the fact that hard tabs were introduced to the codebase. :-) I hope it’s okay if I sometimes don’t get to answering your feedback immediately, but take a bit longer. Your comments are very much appreciated, though!

I addressed the first two items of your list. By adding the scrollbar to CommitList, we get it in the “Log” tab for free.

Let me know what you think!

@extrawurst
Copy link
Collaborator

@extrawurst That took longer than expected, not least due to the fact that hard tabs were introduced to the codebase. :-)

sorry for that. but rustfmt can only enforce hard tabs and not the other way around :(

I hope it’s okay if I sometimes don’t get to answering your feedback immediately, but take a bit longer.

no problem at all, we all do this in our spare time ❤️

I addressed the first two items of your list. By adding the scrollbar to CommitList, we get it in the “Log” tab for free.

Let me know what you think!

looks good! is there any gotchas left that you know of, or do you think we can merge this as an MVP?

@extrawurst
Copy link
Collaborator

extrawurst commented Aug 28, 2021

@cruessler I revisited #381 and realise now that we are using the regular commit list here. I don't think this is what we want for the history view. I think we should aim for something more bespoke, similar to the blame view (short commit list on the left side and a diff of the current selected commit on the right) - similar to how fork visualises it - see #381 (comment)

even if that means we have to make the single entry on the left side pane more than one line but I think it should contain the following:

  • short hash
  • timestamp
  • author
  • message (as much as fits)
  • maybe even the symbol of what kind of file diff it was in this commit (add, rename, modified)

little mockup
Screenshot 2021-08-28 at 14 28 58

@cruessler
Copy link
Collaborator Author

Having a specialized list that shows additional information makes sense to me. I'll see what I can do!

@extrawurst
Copy link
Collaborator

@cruessler are you still on this?

@cruessler
Copy link
Collaborator Author

@extrawurst Yes, I was planning on working on it this weekend!

@cruessler
Copy link
Collaborator Author

@extrawurst I worked on the PR today. While the changes are not ready yet, I made good progress and will likely be able to present results over the coming week. Your proposal works quite well, I think.

@cruessler
Copy link
Collaborator Author

@extrawurst I finally got to updating the PR. It is not yet complete, but I wanted to do it anyway to let you know I have not forgotten the branch. The two-row layout for the items in the table works well, I think. Still missing is the column that shows the modifier for added/modified/deleted as well as the area that shows the diff to the selected line.

@extrawurst
Copy link
Collaborator

@extrawurst I finally got to updating the PR. It is not yet complete, but I wanted to do it anyway to let you know I have not forgotten the branch. The two-row layout for the items in the table works well, I think. Still missing is the column that shows the modifier for added/modified/deleted as well as the area that shows the diff to the selected line.

That starts to look really cool already though! Thanks for holding on here ❤️

@ajschmidt8
Copy link

Looking forward to this feature addition!!! Thanks for all your work on this @cruessler and @extrawurst

@cruessler
Copy link
Collaborator Author

@extrawurst I’ve tried adding markers for “added/modified/deleted”, but I’m a bit stuck at the moment, and could need some help/input/ideas. The list of commits currently is a Vec<LogEntry> and does not contain the file status. One option would be to build an async way of getting it. Another way would be to introduce a FileLogWalker that includes a file’s status in the commit log, but I’m worried that might duplicate a lot of code in LogWalker. What do you think?

@extrawurst
Copy link
Collaborator

@cruessler I checked out what we have so far and I am a little worried to add more functionality to the current AsyncLog its already combining the revlog and filtering case and still uses the old approach without AsyncJob.

What do you think about building a new FileLogJob that internally uses AsyncJob via composition and hooks into the notifications to followup each batch of commitIds with looking up the markers of the file in that particular commit. this way we can reuse AsyncJob as is and add the state lookup in an async way.

FileLogJob will then only expose LogEntries we also have the marker for.

@extrawurst
Copy link
Collaborator

@cruessler Merry Christmas 🎄
any updates ? :)

@cruessler
Copy link
Collaborator Author

@extrawurst Not yet, but I want to work on the PR over the holidays. Merry Christmas! 🎄😀

@cruessler cruessler force-pushed the add-file-history branch 2 times, most recently from fc21f4b to 24892bb Compare December 29, 2021 16:23
@extrawurst
Copy link
Collaborator

@cruessler cool progress!!

Screenshot 2022-01-10 at 01 31 15

@extrawurst
Copy link
Collaborator

@cruessler if the modification type makes this overly complicated maybe we can do a MVP that we polish a bit?

  • diff side-by-side
  • scrollbar
  • page-up/down support

@extrawurst
Copy link
Collaborator

@cruessler ping? 🥺

@cruessler
Copy link
Collaborator Author

@extrawurst I implemented your suggestions, and I think the PR is now ready for a first test and review. I have not yet cleaned up the code. I started extracting out AsyncFileLogJob, but I did not finish, so there are a few lines commented out that I possibly wanted to incorporate into the new trait. Let me know what you think and how to best proceed from here! And thanks for encouraging me to finish the work! :-)

@cruessler cruessler marked this pull request as ready for review January 30, 2022 13:57
@extrawurst
Copy link
Collaborator

extrawurst commented Jan 30, 2022

@cruessler it really depends on how much time you have to work on this. the biggest thing is actually the missing AsyncFileLogJob abstraction to combine the revlog fetching and then doing the get_commits_info on them. since I want to merge this as soon as possible I would say lets clean up the few small comments, remove the undone and unused AsyncFileLogJob and lets merge this

edit: something interferes with the syntax view in the file-tree, its stays empty in this branch. not sure yet why

@cruessler
Copy link
Collaborator Author

@extrawurst Next week I probably have little free time, so from my perspective it makes sense to merge first and address the outstanding issues later. I’d be happy to address them myself, but I totally understand if you don’t want to wait for that. I’m sure I would find other open issues. :-)

I found the reason for the file contents not being shown and pushed an additional commit.

@extrawurst extrawurst merged commit b622cee into gitui-org:master Jan 30, 2022
@extrawurst
Copy link
Collaborator

@cruessler thanks for sticking with this! this is a great addition! checkout when this effort started: august 2021! Awesome work🥳

@cruessler
Copy link
Collaborator Author

@extrawurst I’m super happy this finally got merged! 🎉 Thanks a lot for being so patient!

@cruessler cruessler deleted the add-file-history branch January 30, 2022 18:49
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.

View log/history of a file
3 participants