Skip to content

Implement a gui for doing simple history rewrites

This series of commits introduces some basic GUI support for git history rewriting/rebasing. Currently the following operations are supported:

  • editing historical commit messages
  • Commit operations:
    • editing historical commits
    • squashing commits
    • splitting commits into two (either split off changes to selected lines, or changes to selected files)
    • exchanging the order of two commits
    • removing a commit
    • hard/soft resetting to a historical commit

The following screenshots illustrate the interface, which consists of a tree view showing the history (in the Git Commit tab, under the commit area). Clicking on a commit in the view opens a (readonly) tab in the main document view with the commit details and a diff. Hovering over a commit shows its full commit message:

image

The context menu for a commit in the history view is the main interface to the editing operations (together with drag & drop):

image

The context menu for a file in the history view allows extracting files into a separate commit.

image

Showing a commit diff --- a context menu allows selected changes to be extracted into a separate commit or moved into the parent/child commits. A similar menu allows squashing the whole commit with its parent or child or exchanging the order of a commit and its parent/child.

image

Editing a commit message when squashing...

image

Editing a commit.

image

The implementation is split into several commits:

  • 4faba93c Implement the GUI part of rebasing
  • 37c97ddf Implement the NON-GUI part of rebasing
  • 217b806a Add a history tree model for VCS repositories.

Additionally, there are several preparatory commits, either introducing some general infrastructure (e.g. new helper job classes), fixing bugs or optimizing operations, which are heavily used by the rebase work:

  • 12e2d787 Adapt GitPlugin::isValidDirectory so that it works for worktrees.
  • ee108c07 Fix diff parsing when new/deleted files are present.
  • 8a266bd1 Fix git diff method to allow "previous" revision in either src or dst args.
  • fc755622 Add a method to basic vcs interface to show the revision diff of a file/dir.
  • 02b4bbf4 Add a memoizing wrapper for VcsJobs.
  • d4f75920 Miscellaneous small infrastructure changes to prepare for rebasing support.
  • 869eae97 Shortcircuit toolview logic for non-user facing jobs.
  • 2222d461 Add some convenience job classes + some signals to executecompositejob.
  • 74de2983 Enrich the VcsDiff class to prepare for rebase operations.
  • 35d7c24a Fix leak in VcsDiff
  • 8099ab8a Provide more data from git::log.
  • 2547b585 Optimize GitPlugin::log
  • 01136e87 Extend VcsEvent with custom data + convenience message functions.
  • 50c40567 fix: Don't leak context menus.

There is more to do, e.g.,

  • the view could show signature statuses, branches, tags
  • perhaps extracting commits into separate branches would be nice (though I am not sure about what the GUI should look like)
  • conversely, cherry-picking from other branches would be nice
  • rebasing a given commit onto another one (again, I am not sure how the GUI would look like, in particular, how to best choose the target commit onto which to rebase)

but I think that what is there is (at least for me :-)) already quite useful.

Edited by Jonathan Verner

Merge request reports