Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fileset parameters in revset aliases are treated as string literals when combined with fileset operators #8311

@uasi

Description

@uasi

Description

When defining revset aliases that accept fileset patterns as parameters, the parameters work correctly when passed directly to files(). However, when those parameters are used with fileset operators (e.g. "f(x)" = "files(~x)"), the names of the parameters are incorrectly interpreted as string literals instead of being substituted with the actual argument value.

Background

I wanted to define "files_only(x)" = "files(x) ~ files(~x)" to select commits that only modify the specified set of files.

Steps to Reproduce the Problem

repro.bash:

cat > config.toml <<'TOML'
[user]
name = "name"
email = "email"

[revset-aliases]
"f(x)" = "files(x)"
"not_f(x)" = "files(~x)"
"all_but_f(x)" = "files(all() ~ x)"
"f_or_b(x)" = "files(x | 'b')"
TOML

export JJ_CONFIG=$PWD

jj git init repro
cd repro

echo A > a
jj ci -m 'touch a'
echo B > b
jj ci -m 'touch b'
echo X > x
jj ci -m 'touch x'

echo '# f("a")'
jj log -r 'f("a")'
echo '# not_f("a")'
jj log -r 'not_f("a")'
echo '# all_but_f("a")'
jj log -r 'all_but_f("a")'
echo '# f_or_b("a")'
jj log -r 'f_or_b("a")'

Expected Behavior

All aliases work, as illustrated below:

...
# f("a")
○  ...
│  touch a
~
# not_f("a")
○  ...
│  touch x
○  ...
│  touch b
~
# all_but_f("a")
○  ...
│  touch x
○  ...
│  touch b
~
# f_or_b("a")
○  ...
│  touch b
○  ...
│  touch a
~

Actual Behavior

Only "f(x)" = "files(x)" works. In other aliases, x is interpreted as 'x'.

Initialized repo in "repro"
Hint: Running `git clean -xdf` will remove `.jj/`!
Working copy  (@) now at: mrnnxxxm 4cd784d4 (empty) (no description set)
Parent commit (@-)      : mtoonwqz 61e99def touch a
Working copy  (@) now at: sqpwpopu efd59df1 (empty) (no description set)
Parent commit (@-)      : mrnnxxxm da75d9bd touch b
Working copy  (@) now at: yoxmynww 7bac8fac (empty) (no description set)
Parent commit (@-)      : sqpwpopu 7c36ffbd touch x
# f("a")
○  mtoonwqz email 2025-12-14 00:37:12 61e99def
│  touch a
~
# not_f("a")
○  mrnnxxxm email 2025-12-14 00:37:13 da75d9bd
│  touch b
○  mtoonwqz email 2025-12-14 00:37:12 61e99def
│  touch a
~
# all_but_f("a")
○  mrnnxxxm email 2025-12-14 00:37:13 da75d9bd
│  touch b
○  mtoonwqz email 2025-12-14 00:37:12 61e99def
│  touch a
~
# f_or_b("a")
○  sqpwpopu email 2025-12-14 00:37:13 git_head() 7c36ffbd
│  touch x
○  mrnnxxxm email 2025-12-14 00:37:13 da75d9bd
│  touch b
~

Specifications

  • Platform: macOS 26.1
  • Version: jj 0.36.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions