Replies: 2 comments
|
To answer this question: "Does the current working-copy commit modify any files relative to its parent(s)?", use: jj log -r @ --no-graph -T emptyThis returns one of the following strings:
Note: when scripting, test the string, not the process exit status code. The status code will be So for my use case, I only need to call Why does this work? According to Templates :
|
|
My approach to this has been to compare the outputs of the published view (using published=$(jj --quiet --ignore-working-copy log --no-graph -r @ -T commit_id)
prospective=$(jj --quiet --no-integrate-operation log --no-graph -r @ -T commit_id)
### would snapshot update the revset? ###
[[ "$published" != "$prospective" ]] |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
How can a script detect if a snapshot is need (i.e. would be taken if one tried)?
Unlike quantum mechanics, I don't want measurement to change the state of the system ⚛️ ... so the command must not make any changes. 😜
Not Quite:
jj util snapshotI tried this with
jj util snapshot:This suggests it could work, but I need to use
--ignore-working-copyif I want to only detect the state.You can see that
jj util snapshot --ignore-working-copydoes not provide what I want.The newer flag
--no-integrate-operationis closer but still does not do exactly what I want.What Else?
What else should I try?
Why
I would like to be able to do something like this:
jj new --if-dirty(my best flag name so far)jj new --if-needed(I don't like this as much because it might be unclear what exactly "is needed" means.)Documentation
All reactions