From 6d5390d1db8a6ddd0abe125f318af0c856fbd7fd Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Tue, 19 Sep 2023 19:20:30 -0700 Subject: [PATCH] cli: add upstream remote to default trunk() This makes trunk() correct after `jj git fetch --remote upstream --branch main`. --- cli/src/config/revsets.toml | 3 +++ docs/revsets.md | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/src/config/revsets.toml b/cli/src/config/revsets.toml index e735fe0d7f..28ae5f82c8 100644 --- a/cli/src/config/revsets.toml +++ b/cli/src/config/revsets.toml @@ -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() ) ''' diff --git a/docs/revsets.md b/docs/revsets.md index a6673db9ab..26bf34d327 100644 --- a/docs/revsets.md +++ b/docs/revsets.md @@ -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: