ManualChanges and reviews
Stacks and dependencies
Two edits can depend on each other and still be easier to review separately. A stack lets you do that.
When should I use a stack?
Section titled “When should I use a stack?”To add --timeout to our command-line tool, we need to parse the flag and then have the HTTP client use its value. If you’d like different people to review those pieces, you can make two commits, one on top of the other.
| Change | What the reviewer sees |
|---|---|
| #41 parses the timeout | The new argument, accepted units, and parser tests |
| #42 applies the timeout | The HTTP client reading the parsed value and cancelling a slow request |
Send each commit as its own change and you have a stack. The person reviewing #42 can look at the HTTP client while #41 is still open for review. Open the Stack panel on either change to see the order they’ll land in, starting with the top row.
How do I send the two changes?
Section titled “How do I send the two changes?”Open Push in Berrit and select jj. Follow the setup for your clone, including the command to mark the target branch immutable. With the second commit as your working copy, send both commits together. For a target named main, use this command.
jj gerrit upload --remote berrit --remote-branch mainEach commit has its own change ID, so this opens two reviews. If someone asks you to fix the parser, edit its commit in jj. jj rebases the HTTP client commit on top of your edit. Resolve any conflicts, then add -r <client-change-id> to the same upload command, using the client’s local change ID from jj log. That sends the updated client and the parser below it, even if your working copy is still on the parser.
Already pushed your branch to the Git host? Open Changes → New change. Choose A change per commit if the commits form a linear sequence with distinct change IDs. Choose One change if you want a single review for the combined work. Changes and revisions.
Can the parser land first?
Section titled “Can the parser land first?”Yes. Ask to land #41 on its own. You can ask to land #42 on its own, too. Berrit will wait until #41 has either landed or taken a place ahead of it in the train.
If you want both pieces to arrive together, choose Land the stack on #42 while #41 is still open and outside the train. Berrit includes the open changes below #42 that target the same branch. Each change still needs its own approvals. After any required train checks pass on the combined code, the train moves the branch forward once for the whole group. If the group is ejected, both changes stay open. If the parser should be able to land even when the HTTP client fails its tests, ask to land the parser on its own. How the merge train works.
Once the parser lands, your local stack may still contain both commits. If you use Berrit’s CLI, run berrit sync --dry-run from the stack to fetch the target and see what would move. Run berrit sync to rebase onto the new tip. A local commit whose patch has already landed drops out when it becomes empty.
What if the dependency is in another repository?
Section titled “What if the dependency is in another repository?”Say the CLI needs an HTTP client from a separate client repository in the same Berrit organisation. Add a Depends-On: client#18 trailer to the CLI commit and Berrit waits for that change to land first. This sets the landing order. If your CLI tests need the new client, your build still has to fetch the version that contains it. Each repository runs its own checks.