git-annex/doc/todo/import_tree_preferred_content_expansions.mdwn
Joey Hess 9a67ed0f10
importtree: support preferred content expressions needing keys
When importing from a special remote, support preferred content expressions
that use terms that match on keys (eg "present", "copies=1"). Such terms
are ignored when importing, since the key is not known yet.

When "standard" or "groupwanted" is used, the terms in those
expressions also get pruned accordingly.

This does allow setting preferred content to "not (copies=1)" to make a
special remote into a "source" type of repository. Importing from it will
import all files. Then exporting to it will drop all files from it.

In the case of setting preferred content to "present", it's pruned on
import, so everything gets imported from it. Then on export, it's applied,
and everything in it is left on it, and no new content is exported to it.

Since the old behavior on these preferred content expressions was for
importtree to error out, there's no backwards compatability to worry about.
Except that sync/pull/etc will now import where before it errored out.
2023-12-18 16:27:59 -04:00

17 lines
782 B
Markdown

Importing a tree from a special remote
when it has a preferred content configured currently only works when the
expression does not use any terms that operate on keys.
(Eg things like copies=).
[[!commit e06feb7316af35b1277b7159a74c216c8f2e7422]]
implemented that. Could it be extended to also support
using it with an expression that does operate on keys?
This would probably entail making any term of the expression that needs a
key evaluate to true. Then it would import all files
(that match also terms that don't need a key). After the import, it may
turn out that the special remote doesn't want to contain particular content
that was imported from it, and it would make sense that an export to the
special remote would remove those files. --[[Joey]]
> [[done]] --[[Joey]]