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

toolkit: Add list-topics command #141

Conversation

brian-kubisiak-skydio
Copy link

@brian-kubisiak-skydio brian-kubisiak-skydio commented Jan 10, 2024

The list-topics command lists the topics for the current branch along
with (optionally) the commit ID or commit title of all commits that
are part of the topic. This is useful for scripts that needs a list of
the available topics (e.g. in a prepare-commit-msg git hook).

Signed-off-by: Brian Kubisiak brian@kubisiak.com

@brian-kubisiak-skydio
Copy link
Author

Reviews in this chain:
#141 toolkit: Add list-topics command

@brian-kubisiak-skydio
Copy link
Author

brian-kubisiak-skydio commented Jan 10, 2024

# head base diff date summary
0 e469eb4c a05fd5eb diff Jan 10 9:22 AM 2 files changed, 16 insertions(+)
1 05bbdccb a05fd5eb diff Jan 11 6:14 AM 2 files changed, 18 insertions(+), 2 deletions(-)

revup/toolkit.py Outdated
topics = TopicStack(git_ctx, args.base_branch, args.relative_branch)
await topics.populate_topics()
for topic in topics.topics.values():
topic_commits = " ".join(commit.commit_id for commit in topic.original_commits)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is the commit id specifically useful here? i'd think users would prefer having commit title instead

i'd recommend the following:

list-topics just prints topics newline separated
with --commit-id, lists commit ids newline separated as well. so there'd be 2 newlines between different topics
with --title, lists commit titles newline separated similar to above

that should in theory work with what you want and is more flexible. newline is so we don't run over the edge of the screen with topics that have a lot of commits

Choose a reason for hiding this comment

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

is the commit id specifically useful here? i'd think users would prefer having commit title instead

Yes the commit id is much more useful for scripts that parse the output.

list-topics just prints topics newline separated
with --commit-id, lists commit ids newline separated as well. so there'd be 2 newlines between different topics
with --title, lists commit titles newline separated similar to above

Done. Might be worth considering doing something like " " followed by the list of commits instead of seperating topics by the double-newline, which I think is marginally simpler to parse from a script (and matches what git does in several places).

The list-topics command lists the topics for the current branch along
with (optionally) the commit ID or commit title of all commits that
are part of the topic. This is useful for scripts that needs a list of
the available topics (e.g. in a prepare-commit-msg git hook).

Signed-off-by: Brian Kubisiak <brian@kubisiak.com>
@jerry-skydio jerry-skydio merged commit 8298f2c into Skydio:main Feb 2, 2024
5 checks passed
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.

3 participants