Когда я синхронизирую две папки с помощью Unison, кажется, что это влияет только на один из корней. Ниже представлена вся информация, которая, на мой взгляд, необходима, чтобы понять, почему она работает так, как есть.
я использую
$ unison -version
unison version 2.27.57
Из репозиториев Ubuntu.
Мой рабочий ноутбук:
$ 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
И сервер Ubuntu, с которым я хочу синхронизироваться:
$ 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
Выполняю унисонную синхронизацию:
$ 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)
А затем проверьте каталог .unisonroot на компьютере, с которого я начал синхронизацию:
$ ls .unisonroot/
aDirectoryFrom-worklaptop aFileFrom-worklaptop
И на сервере:
$ echo $UNISONLOCALHOSTNAME
workcmpuserbardevel
$ ls .unisonroot/
aDirectoryFrom-worklaptop aFileFrom-worklaptop
aDirectoryFrom-workcmpuserbardevel aFileFrom-workcmpuserbardevel
Как видно выше, содержимое .unisonroot ноутбука не изменилось, а содержимое .unisonroot серверов изменилось. Желаемым результатом было бы то, что две папки оказались бы идентичными, удерживая объединение содержимого двух корней.