Skip to content

feat(docs): Add documentation for the rewrite command#121

Merged
aawsome merged 4 commits intorustic-rs:mainfrom
s-leroux:feat/rustic-rewrite
Feb 13, 2026
Merged

feat(docs): Add documentation for the rewrite command#121
aawsome merged 4 commits intorustic-rs:mainfrom
s-leroux:feat/rustic-rewrite

Conversation

@s-leroux
Copy link
Contributor

This adds documentation for the rewrite command, explaining how to modify existing snapshots.

It's a first draft focussing only on removing files.

@s-leroux s-leroux force-pushed the feat/rustic-rewrite branch from 340065a to 99a67c1 Compare January 23, 2026 15:34
@s-leroux s-leroux marked this pull request as draft January 23, 2026 18:32
@aawsome
Copy link
Member

aawsome commented Jan 24, 2026

Thanks @s-leroux for the draft.

First, there are improvements for rewrite on the way giving more options and adding by default a rewrite tag. So, please wait until they land in nightly (maybe today or tomorrow).

One comment: instead of using rustic find to find affected snapshots, using -n outputs which snapshots would be modified by the given rewrite options (and omits the ones which are not affected) - so maybe this should be shown in the docu?

@s-leroux
Copy link
Contributor Author

s-leroux commented Jan 29, 2026

First, there are improvements for rewrite on the way giving more options and adding by default a rewrite tag. So, please wait until they land in nightly (maybe today or tomorrow).

No problem: I was busy all week, so I didn't have time to work on that anyway.

  • rewrite -n instead of/as a complement to find
  • rewrite extra options
  • default tagging

@aawsome
Copy link
Member

aawsome commented Jan 29, 2026

see rustic-rs/rustic_core#465 (is included in the nightly builds already)

This adds documentation for the `rewrite` command, explaining how to modify existing snapshots.
Add the {add,set,remove}-tags options
Add the --set-hostname option
@s-leroux s-leroux force-pushed the feat/rustic-rewrite branch from e165552 to d4a1e5a Compare February 3, 2026 13:21
@s-leroux
Copy link
Contributor Author

s-leroux commented Feb 3, 2026

I have updated my PR as best I could.
However, I didn't have the time to detail all the rustic rewrite options.

Let me know if any changes are needed.


Remark: I noticed we cannot combine several rewrite operations in one command, like:

$ rustic rewrite --add-tags ... --remove-tags ...
<error>

Is this a design choice?

Notably, if we could use both --glob and --add-tags in the same command, --tags-rewritten becomes redundant. Speaking of that, I used --tags-rewritten '' in the docs. Is it the canonical way to prevent the rewrite auto-tagging?

@aawsome
Copy link
Member

aawsome commented Feb 3, 2026

Hi @s-leroux Actually you can use --glob in combination with --add-tags. There is only a restriction about combining --add-tags and --remove-tags which I consider to be a bug. I'll fix that.

@aawsome
Copy link
Member

aawsome commented Feb 3, 2026

Speaking of that, I used --tags-rewritten '' in the docs. Is it the canonical way to prevent the rewrite auto-tagging?

It this the preferred way unless you use --force which by default does not tag the new, but remove the old snapshots. But this can also be overwritten by setting --tags-rewritten.

@aawsome aawsome marked this pull request as ready for review February 13, 2026 19:59
@aawsome aawsome merged commit f98e230 into rustic-rs:main Feb 13, 2026
2 checks passed
@aawsome
Copy link
Member

aawsome commented Feb 13, 2026

@s-leroux I merged this as having this in the docu is much better than having nothing! You can make a future PR if you want to update/change anything.
I think I'll try to talk about rustic tag. This is basically just a shortcut for rustic rewrite with the tag options..

@s-leroux
Copy link
Contributor Author

s-leroux commented Feb 14, 2026 via email

@s-leroux
Copy link
Contributor Author

s-leroux commented Feb 14, 2026 via email

@s-leroux
Copy link
Contributor Author

s-leroux commented Feb 14, 2026 via email

@aawsome
Copy link
Member

aawsome commented Feb 14, 2026

3 févr. 2026 15:23:21 aawsome @.***>:
It this the preferred way unless you use --force which by default does not tag the new, but remove the old snapshots.
I noticed that several times: you talk about the '--force' option. Isn't it the '--forget' option instead? If for whatever reason you want to keep both the original and the rewritten one without an extra tag --tags-rewritten '' remains the answer, or it isn't?

Ah, sorry, yes I meant '--forget. For --forget --tags-rewrittenis by default empty, whereas it isrewriteif no--forgetis given. So,--tags-rewritten ''does not add a an extra tag to the new snapshots, also if no--forget` is chosen.

@aawsome
Copy link
Member

aawsome commented Feb 14, 2026

3 févr. 2026 15:21:56 aawsome @.***>:
There is only a restriction about combining --add-tags and --remove-tags which I consider to be a bug.

Just realized that I forgot to fix that. I just made rustic-rs/rustic_core#476, but that will be only in the next release...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants