The sound distributed version control system

#834 Request: option for `log` to list file names

Closed on February 8, 2024
joyously on October 30, 2023

While trying to expand the Diffuse tool to utilize Pijul, I need to get a list of files affected by a change. In Git, the log command has an option to include file names. Can this option be added to pijul log?

pmeunier on December 25, 2023

This would actually be an excellent introduction to Pijul’s datastructures, for anyone who wants to do it. @joyously, if you’re interested in adding that, I can provide as much support as you need.

oknozor added a change on February 6, 2024
TQU67HU5IACHDG72A4H6FTFU4VWYXUNZQRDE3XENHTB43KHYIXSQC
oknozor on February 6, 2024

Hey, first contribution here :)

I made a really naive implementation and I am not sure if this is the correct way to implement this. Also we probably want to add some information about what kind of changes is being applied per file (addition, deletion etc), and maybe the associated diff ?.

Here is the current ouput format:

Change TQU67HU5IACHDG72A4H6FTFU4VWYXUNZQRDE3XENHTB43KHYIXSQC
Author: Okno (oknozor) <paul.delafosse@protonmail.com>
Date: Tue, 6 Feb 2024 09:22:09 +0000

    Add hunk paths to log ouput

   Changes:
       - pijul/src/commands/log.rs

Change X642QQQTS4X2DENIZT7PGJN2M2FYVFMGGANXSZHJ7LBP6442Z6IAC
Author: G2Wck5FShFeTVqwzUwUXgGzmv6U7RhiXprPScpBxxyWw
Date: Mon, 8 Jan 2024 10:10:31 +0000

    Run record hooks from the repository root

   Changes:
       - pijul/src/config.rs
       - pijul/src/commands/record.rs
joyously on February 6, 2024

I was clicking on code in the change page for review, but it doesn’t do anything…

For let show_paths = cmd.files; it seems to ignore that there could be a --hash-only flag.

For the actual output, I think there are currently two output options (plaintext and json). I don’t know where this is handled though.

It is confusing to use the label Changes: for the files, since the first line is Change: <hash>. I suggest Files: or Paths:.

If the info is readily available, marking the files with their status similar to the diff -s would be even better.

oknozor added a change on February 7, 2024
Add hunk paths to log ouput created on February 6, 2024
GCYF326QZJA32TSYHSOH4XKKDYOJHMD4UWS4B7BJZA4KBJDMLQYQC
oknozor on February 7, 2024

Hello @ joyously, I updated the change so --hash-only and --files arg now conflicts. I changed the label which is now Files.

If the info is readily available, marking the files with their status similar to the diff -s would be even better.

Regarding the output format I am not sure I want to do this yet, I think pijil diffs and log output should have the same kind of output (at least for the diff part). I started another discussion here pijul/872. Maybe it would be better to address this in a separate patch.

pmeunier on February 7, 2024

Welcome here @oknozor. Excellent job! Just one thing, it seems you didn’t run cargo fmt before recording your change, would you mind doing that and amending again?

oknozor on February 7, 2024

Hey @pmeunier, thank you. I did not ran cargo fmt on purpose, when running it I get a very large diff. Not sure why. Here is my current toolchain, rustc 1.75.0, rustfmt 1.7.0-stable.

pmeunier on February 7, 2024

One thing you can do is cargo fmt then pijul rec pijul/src/commands/log.rs --amend ….

Or you can do C-c C-c C-f from emacs in your file.

oknozor added a change on February 7, 2024
Add hunk paths to log ouput created on February 6, 2024
ATUZBEPEZDUXR55MJQB35GUANAJVO6JENHYXDJBFKETZ6AT4DRIAC
main
oknozor on February 7, 2024

Thank you, here you go :)

pmeunier closed this discussion on February 8, 2024