Open farhaan-shamsee opened 1 month ago
Sounds like migrations. You'd have a migration between v1 and v2 that does the file backup for you and prints a message.
It could be done with migrations, but in reality those run at the end of the update. However the feature request is to have messages at the beginning AFAICS.
Sounds like migrations. You'd have a migration between v1 and v2 that does the file backup for you and prints a message.
Yes, this can resolve/help in my use case but partially. As mentioned by @yajo , there can be some use cases where we want the messages to be printed before also.
Can't you just add a message like: "If you are doing a major version update, make sure to check the template change log."?
Yes, in fact this is what we are doing currently, redirecting them to our release notes. And also looking at the migrations as mentioned above. I believe this fulfils our requirement.
Actual Situation
Currently the
message_before_update
and similar messages gets printed on every copy or update.There can be the case where I want some specific message to be printed when a condition is met. I think this is not possible currently.
Desired Situation
In my case, I have different versions of template. So when a user is updating from
1.0.0
to2.0.0
, I want a message to be printed, for example to take backup of a file, as it will be a breaking change.But if the user is already on
2.0.0
, and runs update to change some answers, then I do not want the same message to be displayed.Or in short the update message should be displayed on the first update only of a particular template version.
Proposed solution
As a workaround for my use-case, I was trying to get the
_copier_answers._commit
value from the answers file and then apply some logic to check if the version of template was changing (as it will only change if I am updating to new template version). But it seems that the_commit
value changes even before the update command gets executed. So I do not have any way of getting the previous value of_commit
.