new feature: import/export marked commit lists#915
Open
aaptel wants to merge 6 commits intojonas:masterfrom
Open
new feature: import/export marked commit lists#915aaptel wants to merge 6 commits intojonas:masterfrom
aaptel wants to merge 6 commits intojonas:masterfrom
Conversation
BP is short for BackPort. When you need to do a lot of backporting it
is useful to be able to mark/unmark and load/save lists of commits.
Currently tig has one global bplist, but the implementation is generic
enough and works on bplist instances so that in the future we could
have multiple bplist.
* bplist_init(): initialize a bplist
* bplist_read(): load a bplist from a file into an initialized bplist
* bplist_has_rev(): checks whether a bplist contains a commit rev
* bplist_add_rev(): adds a rev to a bplist if it is not already there
* bplist_rem_rev(): removes a rev from a bplist if it holds it
* bplist_toggle_rev(): adds/remove rev from a bplist
* bplist_write(): dump a bplist to a file
A bplist file is a plain text file where each line is in the form of
<sha1>[ <text>]
Lines who do not match this format will be added as-is and not be
considered as commit. When writing a bplist, commits are sorted by
commit date.
Non-commit lines get a commit date of 0 and they end up at the top of
the line as a result.
* initialize the bplist in main() before parsing options * add -l to load a bplist file or specify a file to save to on exit * handle -lfoo and -l foo * write bplist on exit if a file was specified
adds main-bp-mark line style option.
|
I came here just to say this is exactly the feature I'm looking for! My dev workflow is somewhat messy, and tends to be At the moment a is cmdline, c I actually use tig (previously to get the sha1, but now I found I can usefully bind a command), but (b) is a fairly rote 'git rebase -i'. I think someone else was after a 'mark this commit so I can trigger a diff against it with a different commit' which would also be of interest. |
Collaborator
|
An alternative to this PR could be (with tig 2.5.0):
|
AlexanderSidorenko
pushed a commit
to AlexanderSidorenko/sidorenko_dotfiles
that referenced
this pull request
Jun 13, 2025
Based on a workaround suggested in this (unmerged) pull request: jonas/tig#915
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When doing large backports or similar work that involves a lot of
cherry picking, it can be useful to maintain lists of commits. While
in the main view, Tig can mark commits via the toggle-bp-mark action,
which is bound to C-b by default. Marked commits title will be
displayed using an alternative style (main-bp-mark).
If a path is specified when running Tig (see
-loption). Tig canread and write marked commits. Tig tries to import that file on
startup if it exists, and writes to that file on exit.
The format of this file is simple, each line must have the following format:
Tig tries to keep the content of each line when it imports
it. Additional commits added during the Tig session will use the
commit title as text when exporting.
On exit, Tig sorts the marked commits by commit date (not author date)
and exports the marked lists to the file specified by the
-loption.-lto specify location to import/export marked list toCurrently tig has one global bplist, but the implementation is generic
enough and works on bplist instances so that in the future we could
have multiple bplists.
A bplist holds a list of lines and a hashtable that maps fully-expanded revs to lines.