examinekey: Added --migrate-to-backend

Note that, the way the SeekInput parser is written to support batch mode,
it's actually possible to do git-annex examinekey
"SHA1--foo foo.tar.gz" --migrate-to-backend=SHA1E

While that might be kind of useful to support multiple migrations not using
batch mode, I have not documented it. It would be better to take pairs of
key and file in that case.
This commit is contained in:
Joey Hess 2020-11-12 14:08:13 -04:00
parent 12e32d1dee
commit 7566aa6bc5
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 89 additions and 6 deletions

View file

@ -42,11 +42,37 @@ that can be determined purely by looking at the key.
Messages that would normally be output to standard error are included in
the json instead.
* `--migrate-to-backend=backend`
Attempt to migrate the input key to the new backend specified. If
successful, outputs information about the migrated key. Otherwise,
outputs information about the input key.
This only does fast migrations; it will not re-hash the content of a key
or similar expensive operation.
One way to use it is to add an extension to a key.
git-annex examinekey SHA256--xxx --migrate-to-backend=SHA256E --filename=foo.tar.gz
Or to remove the extension from a key:
git-annex examinekey SHA256E-xxx.tar.gz --migrate-to-backend=SHA256
* `--filename=name`
The name of a file associated with the key, eg a work tree file.
It does not need to exist. This is needed when using `--migrate-to-backend`
to add an extension to the key.
* `--batch`
Enable batch mode, in which a line containing a key is read from stdin,
the information about it is output to stdout, and repeat.
In order to also provide the name of a file associated with the key, the
line can be in the format "$key $file"
# SEE ALSO
[[git-annex]](1)

View file

@ -8,3 +8,5 @@ edit1: I was pointed to [forum/Is_it_possible_adding_files_to_git_annex_bypassin
[[!meta author=yoh]]
[[!tag projects/datalad]]
> [[done]] --[[Joey]]

View file

@ -0,0 +1,7 @@
[[!comment format=mdwn
username="joey"
subject="""comment 4"""
date="2020-11-12T18:08:37Z"
content="""
Implemented examinekey --migrate-to-backend
"""]]