Quando sincronizo duas pastas usando o Unison, apenas uma das raízes parece ser afetada. Abaixo estão todas as informações que eu acho que é necessário para descobrir por que está funcionando como é.
Estou usando
$ unison -version
unison version 2.27.57
Dos repositórios do Ubuntu.
Meu laptop de trabalho:
$ echo $UNISONLOCALHOSTNAME
worklaptop
$ pwd
/home/userfoo
$ ls -lAR .unison*
.unison:
total 8
drwxr-xr-x 2 userfoo userfoo 4096 2010-04-26 11:39 backups
-rw-r--r-- 1 userfoo userfoo 231 2010-04-26 11:38 default.prf
.unison/backups:
total 0
.unisonroot:
total 0
$ cat .unison/default.prf
# Roots of the synchronization
root = /home/userfoo/.unisonroot
root = ssh://devel//home/userbar/.unisonroot
path = *
backuplocation = central
backupdir = /home/.unison/backups
backupprefix = $VERSION.bak
$ mkdir .unisonroot/aDirectoryFrom-$UNISONLOCALHOSTNAME
$ echo something >.unisonroot/aFileFrom-$UNISONLOCALHOSTNAME
$ ls .unisonroot/
aDirectoryFrom-worklaptop aFileFrom-worklaptop
E o servidor Ubuntu que eu quero sincronizar com:
$ echo $UNISONLOCALHOSTNAME
workcmpuserbardevel
$ pwd
/home/userbar
$ ls -lAR .unison*
.unison:
total 4
drwxr-xr-x 2 userbar userbar 4096 2010-04-26 11:38 .unison
.unison/.unison:
total 0
.unisonroot:
total 0
$ mkdir .unisonroot/aDirectoryFrom-$UNISONLOCALHOSTNAME
$ echo something >.unisonroot/aFileFrom-$UNISONLOCALHOSTNAME
$ ls .unisonroot/
aDirectoryFrom-workcmpuserbardevel aFileFrom-workcmpuserbardevel
Eu executo a sincronização uníssona:
$ echo $UNISONLOCALHOSTNAME
worklaptop
$ unison
Contacting server...
Connected [//worklaptop//home/userfoo/.unisonroot -> //workcmpuserbardevel//home/userbar/.unisonroot]
Looking for changes
Warning: No archive files were found for these roots, whose canonical names are:
/home/userfoo/.unisonroot
//workcmpuserbardevel//home/userbar/.unisonroot
This can happen either
because this is the first time you have synchronized these roots,
or because you have upgraded Unison to a new version with a different
archive format.
Update detection may take a while on this run if the replicas are
large.
Unison will assume that the 'last synchronized state' of both replicas
was completely empty. This means that any files that are different
will be reported as conflicts, and any files that exist only on one
replica will be judged as new and propagated to the other replica.
If the two replicas are identical, then no changes will be reported.
If you see this message repeatedly, it may be because one of your machines
is getting its address from DHCP, which is causing its host name to change
between synchronizations. See the documentation for the UNISONLOCALHOSTNAME
environment variable for advice on how to correct this.
Donations to the Unison project are gratefully accepted:
http://www.cis.upenn.edu/~bcpierce/unison
Press return to continue.[<spc>] Waiting for changes from server
Reconciling changes
local workcmps...
dir ----> aDirectoryFrom-worklaptop [f]
file ----> aFileFrom-worklaptop [f]
Proceed with propagating updates? [] y
Propagating updates
UNISON 2.27.57 started propagating changes at 11:49:14 on 26 Apr 2010
[BGN] Copying aDirectoryFrom-worklaptop from /home/userfoo/.unisonroot to //workcmpuserbardevel//home/userbar/.unisonroot
[BGN] Copying aFileFrom-worklaptop from /home/userfoo/.unisonroot to //workcmpuserbardevel//home/userbar/.unisonroot
[END] Copying aDirectoryFrom-worklaptop
[END] Copying aFileFrom-worklaptop
UNISON 2.27.57 finished propagating changes at 11:49:14 on 26 Apr 2010
Saving synchronizer state
Synchronization complete (2 items transferred, 0 skipped, 0 failures)
Em seguida, verifique o diretório .unisonroot no computador em que iniciei a sincronização:
$ ls .unisonroot/
aDirectoryFrom-worklaptop aFileFrom-worklaptop
E no servidor:
$ echo $UNISONLOCALHOSTNAME
workcmpuserbardevel
$ ls .unisonroot/
aDirectoryFrom-worklaptop aFileFrom-worklaptop
aDirectoryFrom-workcmpuserbardevel aFileFrom-workcmpuserbardevel
Como pode ser visto acima, o conteúdo do laptop .unisonroot não mudou enquanto os servidores .unisonroot tem. O resultado desejado seria que as duas pastas acabariam sendo idênticas, mantendo a união do conteúdo das duas raízes.