sapling/eden/scm/tests/test-template-revf64.t
Jun Wu 2e7f12ab4c template: fix ifcontains(rev, revset('.'), ...) compatibility with f64 compatibility
Summary:
The f64 compatibility added by D25079001 (e91552fefe) changes the `{rev}` template output.
However, the revset object is not aware of the rev mapping so the following
pattern will stop working:

  ifcontains(rev, revset('.'), '@', 'o')
  # rev: mapped, but not contains in `revset('.')`

Fix it by teaching `ifcontains(a, b, ...)` to disable f64 compatibility when
evaluating `a`, since `a` is not going to be printed out.

This fixes an issue in VSCode ISL that "You are here" is missing on non-master
commits.

Reviewed By: singhsrb

Differential Revision: D25404673

fbshipit-source-id: 3e53a2ce1f135f8825c195c5a3061dad0359c4b2
2020-12-09 10:36:28 -08:00

46 lines
1001 B
Perl

$ configure modern
$ setconfig format.use-segmented-changelog=1
$ newrepo
$ drawdag << 'EOS'
> B
> |
> A
> EOS
Without revf64compat, rev is not in f64 safe range:
$ setconfig experimental.revf64compat=0
$ hg log -r $A -T '{rev}\n'
72057594037927936
With revf64compat, rev is mapped to f64 safe range:
$ setconfig experimental.revf64compat=1
$ hg log -r $B -T '{rev}\n'
281474976710657
$ hg log -r $B -T json | grep rev
"rev": 281474976710657,
$ hg log -Gr $B -T '{rev}\n'
o 281474976710657
~
$ hg log -Gr $B -T json | grep rev
~ "rev": 281474976710657,
$ hg tip -T '{rev}\n'
281474976710657
$ hg tip -Tjson | grep rev
"rev": 281474976710657,
Both the original and the mapped revs can be resolved just fine:
$ hg log -r 72057594037927936+281474976710657 -T '{desc}\n'
A
B
The pattern "ifcontains(rev, revset('.'), ...)" can still be used:
$ hg up -q $B
$ hg log -r . -T "{ifcontains(rev, revset('.'), '@', 'o')}\n"
@