sincecutoff.com
← all changes

jj templates add list manipulation methods

Introduced 2026-03-04 · score 0.97

HOW TO USE IT

When a jj template needs list manipulation for repository inspection, call the list methods on a list value. Use `jj log -T` with a template such as `self.parents().reverse().take(2).map(|c| c.commit_id().short()).join("\n")` to inspect recent parents.

jj log -T 'self.parents().reverse().take(2).map(|c| c.commit_id().short()).join("\n")'

WHY THIS HELPS

Manipulate list values in a jj template used for repository inspection.

REQUIREMENTS AND LIMITATIONS

  • Version: v0.39.0
  • first(): Returns the first element; errors if the list is empty.
  • last(): Returns the last element; errors if the list is empty.
  • get(index: Integer) (required): Returns the element at the zero-based index; errors if out of bounds.
  • reverse(): Returns the list in reverse order.
  • skip(count: Integer) (required): Skips the first count elements and returns the rest.
  • take(count: Integer) (required): Returns only the first count elements.
  • These methods are supported on list types.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card