The sound distributed version control system

#694 Calculating number of patches since a tag

Opened by mtkennerly on July 7, 2022
mtkennerly on July 7, 2022

I’m trying to integrate Pijul in Dunamai, but I’m not sure how best to find the number of patches between a tag and the current patch. I’m looking for an equivalent to darcs log --from-tag {tag} --count. The best I could come up with currently is:

  • Use pijul log --output-format json and count the output length (channel_patches)
  • Use pijul tag and parse/sort to find the ID of the latest tag in the current channel
    • Side note: Is this output format pretty stable? I can parse it, but just a little worried about breakage since there’s no JSON option.
  • Use pijul tag checkout {tag} and then pijul channel switch {tag} to load the repo at the tag
  • Use pijul log --output-format json and count the output length (tag_patches)
  • Calculate distance = channel_patches - tag_patches
  • Switch back to the original channel

Are there any Pijul features that would lead this approach to an incorrect result? Is there a better way to do this that I’ve missed? Any guidance here would be great!

joyously on July 17, 2022

You can only switch channels if there are no unrecorded changes, so you should be using the --channel flag on the log command.

I’m all for having all the pattern options that Darcs has.