The sound distributed version control system

#127 Ability to `pijul rec --amend` a change with dependents

Opened by cole-h on November 27, 2020 Feature request
cole-h on November 27, 2020

It would be nice if we could amend a change that has dependents and just replay the dependent changes on top of it.

pmeunier on November 28, 2020

Yes indeed. Not sure how to do that though. What happens if you introduce a file in change A, and then edit it in B, but then amend A to say you never introduced the file in the first place?

cole-h on November 30, 2020

By that you mean A has added file asdf, and B has changed lines in file asdf, and you --amend A to remove the added file change? A very good question.

We should probably just disallow that (Dependent B modifies file introduced in A, but file is no longer introduced in A) altogether. Another option would be to remove that change from B (with a warning) but keep it on the user’s FS as an unrecorded change (e.g. shows up in pijul diff).

Ralith on December 11, 2020

As a user, I sometimes actually want to remove a file that was edited in (potentially many) dependent changes. Having to manually amend each dependent change before being able to remove the file would be unpleasant.

pmeunier added tag Feature request on December 7, 2021
a12l on October 14, 2022

You’ve the patches A and B, and B depend on A because all of B’s hunks modifies one or more lines introduced in a subset of A’s hunks.

If you amend A and call the new patch A’, and none of B’s hunks depend on A’, Pijul should warn you when it begins to “replay”. It should when ask the user if the user wants

  • to keep any of the code introduced in patch B by manually “rebasing” the hunks on the new A’; or
  • just delete all hunks whose dependencies no longer exist.

Note that I don’t know how Pijul’s data structure works, so there could be technical reasons why my suggestion doesn’t work in reality.