简体   繁体   English

你如何用 Unison 合并两个冲突的文件

[英]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.

相关问题 如何在未在远程服务器上安装Unison的情况下同步文件? - How to sync files without having Unison installed on the remote server? 如何通过Unison的双向同步获得Lsyncd的文件监视功能? - How to get Lsyncd's file-watching capability with Unison's two-way sync? OSX发生任何更改时,如何触发统一同步文件和目录? - How to trigger unison sync files and directories when there's any change on OSX? 灵活的合并命令以统一选择较新或较旧的文件? - flexible merge command for unison to pick newer or older file? 如何在与unison同步时排除svn元数据? - How to exclude svn metadata while synchronizing with unison? 如何让 output 比较副本的结果一致但不同步它们 - How to let unison output the results of comparing replicas but not synchronize them 如何在perforce和git repos之间同步文件 - How do you sync files between perforce and git repos unison如何决定同步文件的方式 - How does unison decide which way to sync a file 如何同步两个服务器以更改文件和数据库? - How do I synchronise two servers for changes in files as well as database? 让 Unison 记住已同步的文件,尽管它们已从一个副本中删除? - Make Unison remember files that were synchronized although they have been deleted from one replica?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM