Help me figure this out. I can't get it to work.
Here's my hypothetical repo setup: a1 a2 b1 b2
All of these are connected to each other.
Settings are as follows:
group a1 = a 1
group a2 = a 2
group b1 = b 1
group b2 = b 2
wanted a1 = groupwanted
wanted a2 = groupwanted
wanted b1 = groupwanted
wanted b2 = groupwanted
groupwanted 1 = not copies=1:1
groupwanted 2 = not copies=2:1
groupwanted a = not copies=a:1
groupwanted b = not copies=b:1
numcopies default = 2
config annex.synccontent = true
The behavior I want is: Group "a" repos will only have 1 copy of a file, and group "b" repos will only have 1 copy of a file. Similarly, group "1" repos will only have 1 copy of a file, and group "2" repos will only have 1 copy of a file.
So, for example, a file could be stored in a1 and b2, or a2 and b1, but NOT a1 and a2 (both are group "a") or a1 and b1 (both are group "1").
But it doesn't work. When I add a file to a1, it is not copied to b2 on sync. The documentation says repos can have multiple groups, but I'm not sure how the groupwanted settings of multiple groups work together.
Is this even possible?
groupwanted expressions are only used when there is only one that the repository could use. The repository can be in two groups and if only one of the groups has a groupwanted expression, it will be used, but if both do, neither expression will be used.
This limitation to exactly one expression also holds for standard preferred content expressions (which is documented). git-annex does not try to combine together two expressions with OR. Why not? Well, consider the standard preferred content expressions for the client and transfer groups. The one for transfer looks at whether client repositories have the content:
not (inallgroup=client and copies=client:2) ...
If a repository is both a transfer repository and a client at the same time, that would make it want to have content as long as not all clients contain the content -- so once all other clients get the content, the repository would want to drop its copy. But then, it would see that not all client repositories now have the content (since it doesn't!) and want to get it. And potentially round and round..
git-annex actually detects and prevents this kind of drop/get cycle (probably), but the right behavior of combining those two groupwanted expressions is at best undefined. So it's better to have the user write down an expression with what they really want to happen than try to OR expressions.
I've updated the docs for groupwanted to note that it's only used when one of a repos's groups has it.
Thank you for clarifying. I've worked out a setup that seems to do what I want. The rules are a little messier, but not too bad: