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

obslog: reverse order of predecessors in topo traversal #4086

Merged
merged 2 commits into from
Jul 16, 2024

Conversation

scott2000
Copy link
Collaborator

@scott2000 scott2000 commented Jul 14, 2024

Currently, when there is a commit with two predecessors, the graph splits into two branches, and all of the predecessors on the first branch are printed before all of the predecessors on the second branch. This causes the graph to grow wider with each squashed commit, since the second branch must always get indented one level farther each time a commit is squashed. I have some commits where the graph is indented more than 10 levels due to squashing more than 10 times, making it very difficult to read.

Reversing the order and printing the second branch before the first branch prevents this unnecessary indentation and makes the graph easier to read. This does not change the order of the edges in the graph (i.e. the first predecessor is still the first edge and the second predecessor is still the second edge in the graph).

Output before this PR

obslog before

Output after this PR

obslog after

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

cli/src/commands/obslog.rs Show resolved Hide resolved
Currently, when there is a commit with two predecessors, the graph
splits into two branches, and all of the predecessors on the first
branch are printed before all of the predecessors on the second branch.
This causes the graph to grow wider with each squashed commit, since the
second branch must always get indented one level farther each time a
commit is squashed. I have some commits where the graph is indented more
than 10 levels due to squashing more than 10 times, making it very
difficult to read.

Reversing the order and printing the second branch before the first
branch prevents this unnecessary indentation and makes the graph easier
to read. This does not change the order of the edges in the graph (i.e.
the first predecessor is still the first edge and the second predecessor
is still the second edge in the graph).
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

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

Thanks!

@scott2000 scott2000 merged commit 91504ca into martinvonz:main Jul 16, 2024
17 checks passed
@scott2000 scott2000 deleted the obslog-order branch July 16, 2024 01:10
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.

2 participants