[英]How do you merge two conflicting files with Unison
I am having two nfs servers across which I am trying to sync files.我有两个 nfs 服务器,我试图在它们之间同步文件。 I have the unison profile sync.prf this way.
我通过这种方式获得了一致配置文件 sync.prf。
root = /home/ubuntu/nfs # shared directory on server1
root = ssh://ubuntu@XX.XX.XX.XX//home/ubuntu/nfs # shared directory on server2
ignore = Name .git
merge = Name /home/ubuntu/nfs/*txt
There is a hello.txt file in server1 as well as in server2.服务器 1 和服务器 2 中都有一个 hello.txt 文件。 I am trying to merge the content from files across the servers.
我正在尝试跨服务器合并文件中的内容。
While I run the profile using unison sync.prf
, I am getting the failed synchronization.当我使用
unison sync.prf
运行配置文件时,同步失败。 The error is as follows:错误如下:
ubuntu@ubuntu-shivam:~$ unison sync.prf
Contacting server...
Connected [//sshtest-vm-intern//home/ubuntu/nfs -> //ubuntu-shivam//home/ubuntu/nfs]
Looking for changes
Waiting for changes from server
Reconciling changes
local sshtest-v...
changed <=M=> hello.txt [f] m
Proceed with propagating updates? [] y
Propagating updates
UNISON 2.48.4 started propagating changes at 18:04:36.00 on 05 Jan 2023
100% 00:00 ETAFailed [hello.txt]: 'merge' preference not set for hello.txt
UNISON 2.48.4 finished propagating changes at 18:04:36.01 on 05 Jan 2023
Saving synchronizer state
Synchronization incomplete at 18:04:36 (0 items transferred, 0 skipped, 1 failed)
failed: hello.txt
I have tried implementing the merge option in following some ways, but not getting the successful synchronization.我尝试按照某些方式实现合并选项,但没有获得成功的同步。
Path /home/ubuntu/nfs = update
*.txt update
*.txt = update
Name /home/ubuntu/nfs/*.txt
/home/ubuntu/nfs = update
Name /home/ubuntu/nfs/*.txt = merge=update
Path /home/ubuntu/nfs = merge=update
merge = diff3 -m /home/ubuntu/nfs/*.txt OLD /home/ubuntu/nfs/*txt > NEW
Kindly someone help me with the issue.请有人帮我解决这个问题。
Your syntax for the merge
option isn't correct.您的
merge
选项语法不正确。 It should look something like它应该看起来像
merge = Name *txt -> diff3 -m CURRENT1 CURRENTARCH CURRENT2 > NEW
See the see the Merging Conflicting Versions section of the Unison Manual for details and examples.有关详细信息和示例,请参阅Unison 手册的合并冲突版本部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.