forum/git annex get --want-get another_repogit-annexhttp://git-annex.branchable.com/forum/git_annex_get_--want-get_another__95__repo/git-annexikiwiki2014-03-13T11:47:59Zcomment 1http://git-annex.branchable.com/forum/git_annex_get_--want-get_another__95__repo/comment_1_0be0b3981ddd0743ff26cf6d396e521d/joeyh.name2014-03-12T17:15:23Z2014-03-12T17:15:23Z
<p>Well, I suppose this is doable, but the way this scenario is generally handled is to make a transfer repository (which your desktop is serving as here) have a preferred content expression that makes it want files that the client repositories (phones) want, until the files have reached the clients:</p>
<p>In your case you could have:</p>
<pre><code>(not inallgroup=phones and ($phone_preferred_content)) or ($desktop_preferred_content)
</code></pre>
<p>Where <code>$desktop_preferred_content</code> is whatever files the desktop actually wants on its own, and <code>$phone_preferred_content</code> is a copy of the preferred content setting for the phone.</p>
<p>To make this work, you also need to put your phone in the phones group.</p>
comment 2http://git-annex.branchable.com/forum/git_annex_get_--want-get_another__95__repo/comment_2_b1ead1085a87818625579bf1ef151b5d/joeyh.name2014-03-12T17:54:29Z2014-03-12T17:16:59Z
BTW expressing this in the preferred content as above also has the benefit that you can use the new <code>git annex sync --content</code> on the desktop and it will automatically get files, copy the right ones to the phone, and drop any then-unwanted files.
That does it but not totallyhttp://git-annex.branchable.com/forum/git_annex_get_--want-get_another__95__repo/comment_3_cf2018852c84b0bf1ac061def6f0ac5d/Konubinix2014-03-13T11:36:03Z2014-03-13T11:36:02Z
<p>I agree with the fact that it answers my initial question.</p>
<p>Nevertheless, I guess it is really annoying to have to change the preferred content in two locations each time I change want to modify what is on my phone.
Indeed, I quite often change what should be really present on my phone, depending on several factors (my mood, the time I will have in transports and the phase of the moon).</p>
<p>The reason why I use "git annex wanted" is that it is straightforward: I just launch : "git annex wanted phone include=some/file" and that's all.</p>
<p>With the solution you propose, I would have to each time additionally launch "git annex wanted here '(not inallgroup=phones and (include=some/file)) or ($desktop_preferred_content)'"</p>
<p>Where I probably have to previously launch "git annex wanted here" to remember what is the preferred content of my computer (and put it in $desktop_preferred_content).</p>
<p>Another option would be to run "git annex vicfg" and edit both fields manually, but IMHO this appears also to be too complicated relatively to the use case.</p>
<p>About your second comment, I really enjoy the idea if "git annex sync --content", but it is really long in big repositories. I guess it is because I cannot restrict the command to a directory like I do with get, drop, move and copy.</p>
<p>Besides, the use case wants to get the files whenever they are and copy them only to the phone. With git annex sync --content, the files are also put in the other repositories.</p>
<p>For the time being, I prefer falling back to explicit commands that are much faster when I know a directory to sync "git annex get --auto directory && git annex copy --auto --to phone directory".</p>
<p>For example, I just tried "git annex sync --content phone" and I killed it after 5 minutes and nothing was copied yet. With the set of two commands above, the synchronization of directory (get --to phone directory + drop --from here directory) took about 3 minutes.</p>
Precision of the use casehttp://git-annex.branchable.com/forum/git_annex_get_--want-get_another__95__repo/comment_4_22562e8f1f2f91b9f9a5939ec9006cb5/Konubinix2014-03-13T11:47:59Z2014-03-13T11:47:59Z
<p>I realized that the directory restriction described earlier is not clear. Let me explain it.</p>
<p>Say I have a big repository of files with the following structure.</p>
<p>A/...
B/...
C/...
D/D1/...
D/D2/...
D/D3/...</p>
<p>Imagine that each of A, B, C and D contains a lot of files.</p>
<p>Now imagine that I have often put in the preferred content of my phone files in one of D1, D2 or D3. (for instance, include=D/D1/*)</p>
<p>I implicitly know that I can restrict the command to D, and I can rely on preferred content to know what file from D I have to put into my phone.</p>
<p>Then, I can run
$ git annex get --auto D
$ git annex copy --auto --to phone D
$ git annex drop --auto D</p>
<p>This in my use case takes 3 minutes.</p>
<p>When I run
$ git annex sync --content phone</p>
<p>git annex goes recursively through A, B and C and that takes a long time (much more than 3 minutes). This time is really wasted since I know I only want to sync files from D.</p>
<p>I cannot test the behavior of "git annex sync --content", but if I restrict the sync to phone, will it take the files from the NAS to put them on the phone?
If I don't precise phone in the command line, it will try to sync with other repositories not in sync that I don't want to be in sync for the time being.</p>