Skip to content

Commit

Permalink
cli: add upstream remote to default trunk()
Browse files Browse the repository at this point in the history
This makes trunk() correct after `jj git fetch --remote upstream --branch
main`.
  • Loading branch information
ilyagr committed Sep 20, 2023
1 parent 0c31e0b commit 6d5390d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cli/src/config/revsets.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ latest(
remote_branches(exact:"main", exact:"origin") |
remote_branches(exact:"master", exact:"origin") |
remote_branches(exact:"trunk", exact:"origin") |
remote_branches(exact:"main", exact:"upstream") |
remote_branches(exact:"master", exact:"upstream") |
remote_branches(exact:"trunk", exact:"upstream") |
root()
)
'''
8 changes: 4 additions & 4 deletions docs/revsets.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ are defined as aliases in order to allow you to overwrite them as needed.
See [revsets.toml](https://github.com/martinvonz/jj/blob/main/cli/src/config/revsets.toml)
for a comprehensive list.

* `trunk()`: Resolves to the head commit for the trunk branch of the `origin`
remote. The branches `main`, `master`, and `trunk` are tried. If more than one
potential trunk commit exists, the newest one is chosen. If none of the
branches exist, the revset evaluates to `root()`.
* `trunk()`: Resolves to the head commit for the trunk branch of the remote
named `origin` or `upstream`. The branches `main`, `master`, and `trunk` are
tried. If more than one potential trunk commit exists, the newest one is
chosen. If none of the branches exist, the revset evaluates to `root()`.

You can [override](./config.md) this as appropriate. If you do, make sure it
always resolves to exactly one commit. For example:
Expand Down

0 comments on commit 6d5390d

Please sign in to comment.