5

The interactive unison command line provides the following help:

Commands:
<ret> or f or <spc>   follow unison's recommendation (if any)
n or j                go to the next item
p or b or k           go back to previous item
<del> or <bsp>        revert then go back to previous item
0                     go to the start of the list
9                     go to the end of the list
5                     go forward to the middle of the following items
6                     go backward to the middle of the preceding items
R                     reverse the list of paths
d                     show differences (curr or match)
x                     show details (curr or match)
L                     list all (or matching) following changes tersely
l                     list all (or matching) following changes with details
A or *                match all the following
1                     match all the following that propagate from local to saunterblugget
2                     match all the following that propagate from saunterblugget to local
C                     match all the following conflicts
P or =                match all the following with only props changes
M                     match all the following merges
X or !                invert the matching condition
&                     and the last two matching conditions
|                     or the last two matching conditions
D or _                delete/pop the active matching condition
U or $                unmatch (select current)
r or u                revert to unison's default recommendation (curr or match)
m                     merge the versions (curr or match)
> or .                propagate from from local to saunterblugget (curr or match)
< or ,                propagate from from saunterblugget to local (curr or match)
] or "                resolve conflicts in favor of the newer (curr or match)
[ or '                resolve conflicts in favor of the older (curr or match)
c                     resolve conflicts in favor of changed (curr or match)
i                     invert direction of propagation (curr or match)
/ or :                skip (curr or match)
%                     skip all the following
-                     skip and discard for this session (curr or match)
+                     skip and discard all the following
I                     ignore this path permanently
E                     permanently ignore files with this extension
N                     permanently ignore paths ending with this name
s                     stop reconciling and go to the proceed menu
g                     proceed immediately to propagating changes
q                     exit unison without propagating any changes

To me this implies that it is possible, on the command line, to instruct unison to find all files that match some condition and to perform an operation on them, such as skipping them or follow unison's recommendation.

The documentation for unison mentions that it is possible to provide a condition which match certain paths and do things like list all matching files first or last. The documentation does not discuss the manipulation of such conditions with commands like A, &, or |. Other sources of documentation like the wiki and the github project don't seem to provide help about this either.

My question is can someone explain how to use the command line "match" commands?

I'd also like to know things like:

Is the "match" in the command line documentation referring to the same "matching conditions" mentioned in the documentation? If not how does one produce a condition against which to match changes? How does one select matching conditions and manipulate them on the command line?

Ben Whale
  • 493
  • 2
  • 9
  • 1
    did you find an answer? – noobsaibot Dec 11 '22 at 17:56
  • Not so far... I have yet summon the courage to read the code. The issue I opened at github is still open. The unison people have indicated that providing the documentation is "low impact" and "medium-effort" so don't expect anything. – Ben Whale Dec 16 '22 at 04:45

1 Answers1

1

I think these work sort of how you’d expect, only there’s no obvious feedback that your actions are having any effect.

I think the key is the L command to list pending changes.

At the start L might show a long list of changes with question marks in it:

props    <-?-> props      foo.txt
props    <-?-> props      bar.txt

Now if I try to use the match things based on their help summaries, say to select all the files with only props changes and apply from the left, it looks like nothing has happened:

props    <-?-> props        [] P
  Enabling matching condition
props    <-?-> props        [] >
props    <-?-> props        [] $
  Disabling matching condition

but if I list the files again with L I can see that a bunch of question marks are gone, because the requested change has been set:

props    ====> props      foo.txt
props    ====> props      bar.txt

Then you can press g to apply your changes. The UI does seem very awkward to me though, maybe I’m missing something, but it seems to still prompt for all the files you’ve already told it how to handle. One plausible workflow: run unison with g after applying your match stuff—it’ll skip all the files with conflicts—then run unison again to only get prompted about the remaining files it wants help with.

andrewdotn
  • 32,721
  • 10
  • 101
  • 130