Skip to content

Commit

Permalink
restack: Be topological and update docs
Browse files Browse the repository at this point in the history
Restack will now topologically reorder your relative
graph to be linear again. Update docs to reflect this
and the conflict handling.
  • Loading branch information
jerry-skydio committed Mar 13, 2024
1 parent 4c4b457 commit ef12644
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions docs/restack.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ revup restack - Reorder commits to group topics together.

Parse commits up to the base branch and group them into topics.
First apply all commits without a topic in the order they appear.
Then apply all commits in each topic in the order they appear in
the topic, in the order each topic appears. The resulting reordered
commit stack will have topics grouped together to make it more
convenient to view history and perform interactive rebases.
Then apply all commits in each topic in topological order, placing
all topics after (although not necessarily immediately after) any
topic they are relative to. The resulting stack will be grouped to
make it more convenient to view history and perform interactive rebases.

Any empty commit without topics, and any topics consisting only
of empty commits are dropped. An empty commit that is part of
Expand All @@ -24,9 +24,9 @@ a topic that has nonempty commits is not dropped.
The cache and working directory are never modified regardless
of whether the command succeeds or fails.

Currently, conflicts between commits aren't handled. If any conflict
arises, the conflicting file paths will be printed and the program will
exit without making any changes.
If any conflict arises, the conflicting file paths and conflict markers
will be printed, and the conflicts will need to be fixed manually by
adjusting relative topics.

See the help page for **revup upload** for a description of how topic
tags are parsed.
Expand Down
2 changes: 1 addition & 1 deletion revup/restack.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ async def main(args: argparse.Namespace, git_ctx: git.Git) -> int:
)

await topics.populate_topics()

await topics.populate_reviews()
await topics.restack(args.topicless_last)
return 0
2 changes: 1 addition & 1 deletion revup/topic_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ async def restack(self, topicless_last: bool) -> GitCommitHash:
in a single topic consolidated together.
"""
to_pick = []
for topic in self.topics.values():
for _, topic in self.topological_topics():
this_topic = []
topic_is_empty = True
for commit in topic.original_commits:
Expand Down

0 comments on commit ef12644

Please sign in to comment.