Discussion:
[unison-users] can I ask unison to just display the differences?
Nick Demou ndemou@enlogic.gr [unison-users]
2017-07-04 20:34:37 UTC
Permalink
Is there a way to call unison from a script and have it display the list
of differences (like it does when run interactively and you hit L)?

Nick D
Adrian Klaver adrian.klaver@aklaver.com [unison-users]
2017-07-04 20:52:34 UTC
Permalink
Post by Nick Demou ***@enlogic.gr [unison-users]
Is there a way to call unison from a script and have it display the list
of differences (like it does when run interactively and you hit L)?
Something like this?:

***@tito:~/software_projects> unison -ui text local_arkansas
Contacting server...
Connected [//arkansas//home/aklaver -> //tito//home/aklaver]
Looking for changes
Waiting for changes from server
Reconciling changes

local arkansas
new file ----> software_projects/unison_test.txt [f] l
new file ----> software_projects/unison_test.txt
local : new file modified on 2017-07-04 at 13:48:03
size 0 rw-r--r--
arkansas : absent

new file ----> software_projects/unison_test.txt [f]
Post by Nick Demou ***@enlogic.gr [unison-users]
Nick D
--
Adrian Klaver
***@aklaver.com
Adrian Klaver adrian.klaver@aklaver.com [unison-users]
2017-07-04 23:23:52 UTC
Permalink
Post by Nick Demou ***@enlogic.gr [unison-users]
Is there a way to call unison from a script and have it display the list
of differences (like it does when run interactively and you hit L)?
[...] Reconciling changes
local arkansas
new file ----> software_projects/unison_test.txt [f] l
new file ----> software_projects/unison_test.txt
local : new file modified on 2017-07-04 at 13:48:03
size 0 rw-r--r--
arkansas : absent
[...]
Yes like this (but of-course without waiting for me to hit l or anything
else)
Nothing that I could find. I tried playing around with -debug, it looks
to be lower level then you want and spits out a lot of extraneous
information.
--
Adrian Klaver
***@aklaver.com
Nick Demou ndemou@enlogic.gr [unison-users]
2017-07-05 07:27:02 UTC
Permalink
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
Is there a way to call unison from a script and have it display the list
of differences (like it does when run interactively and you hit L)?
[...]
Nothing that I could find. I tried playing around with -debug,
it looks to be lower level then you want and spits out a lot of
extraneous information.
Well if it's something that can be cleared by grep and sed then I'm
curious to check it. After all my only alternative if nothing else comes
up is to call unison under pexpect which feels equally hackish :-)
Adrian Klaver adrian.klaver@aklaver.com [unison-users]
2017-07-05 14:10:30 UTC
Permalink
Post by Nick Demou ***@enlogic.gr [unison-users]
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
Is there a way to call unison from a script and have it display the
list
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
of differences (like it does when run interactively and you hit L)?
[...]
Nothing that I could find. I tried playing around with -debug,
it looks to be lower level then you want and spits out a lot of
extraneous information.
Well if it's something that can be cleared by grep and sed then I'm
Not sure.
Depending on what you need you may also be able to get information out
of the log file.
Post by Nick Demou ***@enlogic.gr [unison-users]
curious to check it. After all my only alternative if nothing else comes
up is to call unison under pexpect which feels equally hackish :-)
--
Adrian Klaver
***@aklaver.com
Nick Demou ndemou@enlogic.gr [unison-users]
2017-07-05 15:29:59 UTC
Permalink
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
Is there a way to call unison from a script and have it display
the list
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
of differences (like it does when run interactively and you hit L)?
[...]
Nothing that I could find. I tried playing around with -debug,
it looks to be lower level then you want and spits out a lot of
extraneous information.
Well if it's something that can be cleared by grep and sed then I'm
Not sure.
Depending on what you need you may also be able to get information out
of the log file.
Thanks for looking into this Adrian. I'll try guiding unison with
pexpect and will report my findings.

import pexpect
child = pexpect.spawnu('unison profile_name')
child.expect('[-=][-=][-=].* \[[f?]\] ')
child.sendline('l')
child.expect('[-=][-=][-=].* \[[f?]\] ')
child.sendline('q')
Nick Demou ndemou@enlogic.gr [unison-users]
2017-08-20 16:12:18 UTC
Permalink
Post by Nick Demou ***@enlogic.gr [unison-users]
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
Is there a way to call unison from a script and have it display
the list
Post by Adrian Klaver ***@aklaver.com [unison-users]
Post by Nick Demou ***@enlogic.gr [unison-users]
of differences (like it does when run interactively and you hit L)?
[...]
Nothing that I could find. I tried playing around with -debug,
it looks to be lower level then you want and spits out a lot of
extraneous information.
Well if it's something that can be cleared by grep and sed then I'm
Not sure.
Depending on what you need you may also be able to get information
out of the log file.
Thanks for looking into this Adrian. I'll try guiding unison with
pexpect and will report my findings.
It was far easier than I thought (but likely summer holidays delayed my
investigation):

# (echo L; echo q ) | ./unison test.perf

The above worked on cygwin and I bet it will work also on Linux. It
produces some extra lines that can easily be filtered out.

Loading...